Skip to Content

Help - Query not selecting specified Date Range

Hello all,

I was able to create a query to retrieve specific quotes for specific Item Groups.  I tried to narrow the search based on Document Date but for some reason it is not working.  Please let me know what I am doing wrong.

SELECT

  T3.[DocNum] AS 'Quote #'

  , T3.[DocStatus] AS 'Document Status'

  , T3.[CardCode] AS 'Customer Code'

  , T3.[CardName] AS 'Customer Name'

  , T3.[DocDate] AS 'Posting Date'

  , T3.[TaxDate] AS 'Document Date'

  , T3.[DocDueDate] AS 'Due Date'

  , T2.[ItemCode] AS 'Item No.'

  , T1.[ItemName] AS 'Item Description'

  , T1.[ItmsGrpCod] AS 'Item Group'

  , T0.[ItmsGrpNam] AS 'Group Name'

  , T4.[Price] AS 'Cost in PriceList'

  , T2.[GrossBuyPr] AS 'Cost from Quote'

FROM  [dbo].[OITB] T0

  INNER JOIN [dbo].[OITM] T1  ON  T1.[ItmsGrpCod] = T0.[ItmsGrpCod]  

  INNER  JOIN [dbo].[QUT1] T2  ON  T2.[ItemCode] = T1.[ItemCode]  AND  T2.[ItemCode] = T1.[ItemCode]  

  INNER  JOIN [dbo].[OQUT] T3  ON  T3.[DocEntry] = T2.[DocEntry]

  Left Outer Join ITM1 T4 on T4.PriceList = '23' and T1.ItemCode = T4.ItemCode  

WHERE

T0.[ItmsGrpNam] Like N'%TCN%'

OR T0.[ItmsGrpNam] Like N'%TFN%'

OR T0.[ItmsGrpNam] Like N'%TGN%'

OR T0.[ItmsGrpNam] Like N'%TN2%'

OR T0.[ItmsGrpNam] Like N'%TN3%'

OR T0.[ItmsGrpNam] Like N'%TN5%'

OR T0.[ItmsGrpNam] Like N'%TNA%'

and T3.[DocDate] >=[%0]

and  T3.[DocDate] <='[%1]'

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 30, 2015 at 02:45 PM

    I should have clarified - the query retrieves all of the quotes since we started using the system for the specific item groups.  I want to narrow the selection to a specific date range (normally a month or quarter).

    Add comment
    10|10000 characters needed characters exceeded