Skip to Content
0
Former Member
May 17, 2016 at 02:51 PM

Date range problem in query

22 Views

I need to pull a report of invoices within a date range that have specific tax codes in the rows. Here is what I have.

SELECT T0.[DocNum],T0.[DocDate], T1.[ItemCode], T1.[LineTotal], T1.[GrssProfit], T1.[TaxCode], T2.[CardName], T3.[SlpName], T0.[TrnspCode] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode

WHERE T0.[DocDate] >= [%0] AND T0.[DocDate] <= [%1]

AND T2.[GroupCode] = 3

AND T1.[TaxCode] = '93510'

OR T1.[TaxCode] = '91301'

It seems to work fine if I have only one tax code however when I add the, OR T1.[TaxCode] = '91301', it no longer respects the date range. Any help would be appreciated.