Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: NotSQL
  • Content: Threads
  • Order by date
  1. NotSQL

    SQL Sytax

    Hi Guys, I have a bit of SQL which stores information into temp tables however I’m sure there is a better way of do this. Any help or suggestions would be grateful. SELECT * INTO #EMAIL FROM KeyCareClean WHERE NOT EXISTS (select * from STUDENT where...
  2. NotSQL

    Store Procedure

    Hi, Im having issues with the performance of this store procedure. does anyone have any ideas how i might improve it? Declare @Year_Local varchar(4), @Quarter_Local varchar(9), @Month_Local varchar(3), @Silo_Local varchar(2) --VisitedTargetedSiloAccounts Select Person_name...
  3. NotSQL

    query optimization

    Can any one suggest how i might improve the performance of this store procedure? It seem to take a while to run and im sure there is a better way of writing it... Declare @Year_Local varchar(4), @Quarter_Local varchar(9), @Month_Local varchar(3), @Person_name_Local varchar(100) Select...
  4. NotSQL

    Query help

    I've written this query, however im not sure it the best way to write it. Could someone please help? Thanks in advance Select t1.* From (Select Silo,Arrow_Silo_Name, AccountName,Account_Name From Sales_Matrix inner join Arrow_Silo_Description on Sales_Matrix.Silo =...
  5. NotSQL

    Query help

    Hi Guys, I have this query below: It works fine however i'd like to use Where t2.NumberOFMeeting = 'Not visited' in the where clause instead of: where t2.NumberOFMeeting is null any help would be appreciated Declare @Year varchar(4) = 2010, @Quarter varchar(9) = null, @Month varchar(3) =...
  6. NotSQL

    Query

    Sorry to bother you all again. Im trying to join these two queries together, can you help. I need all the accounts in query one and a count of meetings that have have taken place which are in query two... I know i need to join on accountName but am unsure how to join the 2 queies Select...
  7. NotSQL

    GOTO

    Can you help me with this GOTO statement Declare @Year varchar(4) = '2010', @Quarter varchar(9) = null, @Month varchar(3) = Null If @Quarter = null and @Month = null GOTO Step_One; Else GOTO Step_Four; Step_One: SELECT 'StepOne', CASE Targeted_Account WHEN 'TRUE' THEN 'Targeted' ELSE...
  8. NotSQL

    Syntax

    Hi Guys,I've been given a task to rewirte a bit of SQL and was wondering if you could help me out. The bit of sql below takesa while to run so any help would be greatful. select NET_AMOUNT,UNIT_AMOUNT,QUANTITY,to_Char(PRO_ID) as ProID,to_Char(PER_ID) as PerID,to_Char(MEM_ID) as MEM_ID from...
  9. NotSQL

    SQL

    Hi Guys, I've been given a task to rewirte a bit of SQL and was wondering if you could help me out. The bit of sql below takesa while to run so any help would be greatful. select NET_AMOUNT, UNIT_AMOUNT, QUANTITY, to_Char(PRO_ID) as ProID, to_Char(PER_ID) as PerID, to_Char(MEM_ID) as MEM_ID...
  10. NotSQL

    SQL Syntax

    Hi guys, I was just wondering if there was a better way of writing this bit of code.. It not the fastest Select t1.PWO,t1.OrderLine, t1.Item,t1.OrderQty, t1.TotalComponentCost, t2.ActLabourHrs, t2.LABOH From (Select PWO,OrderLine,Item, OrderQty, TotalComponentCost from table1 Where...
  11. NotSQL

    SQL Syntax

    Hi Im trying to find out if a record exists in one table and not the other then update a field with a status code. My tables look like this: Table 1 Table 2 RecNum RecNumb ABC IDat Vcode PN Stat So if the record exists in table 2 i want to...
  12. NotSQL

    Latest Record

    Hi, I’m having problems getting the latest record/records from my table. The scenario is: I have a currency table with the exchange rate based on a certain date. What i want to be able to do is select the distinct Currency code based on the max date, is this possible? Or is there a better...
  13. NotSQL

    SQL Syntax

    Hi Guys, I Wonder if you could help. I need to join these too queries together and wonder how. I've given it a go but it just errors. SELECT INVOICE_REGISTER_PO.PurchaseOrder, INVOICE_REGISTER_PO.RegisterNumber, POHMAST.BuyerCode, [SCM Database].dbo.vHLWPurchaseOrderBuyerCode.M685Buyer...
  14. NotSQL

    Calculating Working Days

    Hi Guys, Im trying to calculating the number of working days in each week/month. I currently got a date dimension with the usual fields however not working days. I was looking to use the following syntax to pull working days from the table: Select *, case when Day_Desc in...
  15. NotSQL

    SQL Syntax

    Hi Guys, I wonder if someone could help me with some SQL. I have the following syntax: SELECT RIGHT(Ord.Contract, 4) AS Contract, CASE WHEN Ord.Status IN ('10', '15') THEN '10/15' ELSE Ord.Status END AS ReqStatus, Ord.Part, Ord.[Order], ISNULL(Ord.StartDate, Ord.DueDate) AS...
  16. NotSQL

    Using alias within a calculation

    Hi guys, Im trying to use a alias with in a query but don’t seem to be getting the syntax correct. I need to find the due date then use it to determine if its late or early. Example select z.DueDate, c.Name, case when z.DueDate < getdate() then 'Future' else 'ODue' end as 'ODUE' from...
  17. NotSQL

    Syntax

    hi i wonder if someone could help with the correct syntax. I have the following sql statement select case when DueDate = dateadd(mm,0,DueDate) then sum(Qty) else 0 end as month1, case when DueDate = dateadd(mm,-1,DueDate) then sum(Qty) else 0 end as month2 From dbo.ORD_ITEMS i want to sum the...
  18. NotSQL

    MDX

    hi I wondering if anyone can help. I know the following syntax works, SELECT ([Measures].[SALES]) on columns, LastPeriods(3,[Date].[Hierarchy].[Year].&[2008].&[WK02]) ON Rows FROM [TestCube] however instead of hard coding the week part i want it to pick up the last member in the hierarchy...
  19. NotSQL

    MDX

    I trying construct the first day of the year with no success. I using the following syntax 'January 1,' + vba!Year(vba!dateadd("yyyy", -6, vba![date]())) Can anyone tell me what I’m doing wrong? Also is there an easy way to work out YTD values without using the Business Intelligence wizard...
  20. NotSQL

    YTD

    Hi Guys, Im pretty new to Analysis Service and would like to create a YTD measure with in my cube. How would i go about doing something like this? Regards Dave

Part and Inventory Search

Back
Top