cancel
Showing results for 
Search instead for 
Did you mean: 

Query Help

Former Member
0 Kudos

Hi,

With the query below, filtering based on posting date doesn't work.

Even within the selection period, it will still display all the records that out of the selected period.

SELECT Case When T0.[DocStatus] = 'C' Then 'Closed' When T0.[DocStatus] = 'O' Then 'Open' End 'Document Status', T0.[DocNum], T0.[DocDate], T3.[ItmsGrpNam], T1.[ItemCode], T1.[WhsCode], T0.[DocRate], T1.[Currency], T1.[Price], T1.[Quantity], T1.[LineTotal], T1.[TrgetEntry], T1.[DocEntry] FROM ODLN T0  INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod WHERE T0.[DocDate] >= [%0] AND T0.[DocDate] <= [%1] AND T1.[WhsCode] <> '002' AND T2.[ItmsGrpCod] = '114' OR T2.[ItmsGrpCod] = '113' OR T2.[ItmsGrpCod] = '122'

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Olga,

Check below Query.

I only did small Modification in Conditions.

SELECT Case When T0.[DocStatus] = 'C' Then 'Closed' When T0.[DocStatus] = 'O' Then 'Open' End 'Document Status',

T0.[DocNum], T0.[DocDate], T3.[ItmsGrpNam], T1.[ItemCode], T1.[WhsCode], T0.[DocRate], T1.[Currency], T1.[Price],

T1.[Quantity], T1.[LineTotal], T1.[TrgetEntry], T1.[DocEntry]

FROM ODLN T0 

INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry

INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode

INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod

WHERE T0.[DocDate] >= [%0] AND T0.[DocDate] <= [%1] AND T1.[WhsCode] <> '002'

AND T2.[ItmsGrpCod] IN ('114' , '113' , '122')

Hope this helps

--

--

Thanks & Regards::::

Atul Chakraborty

Former Member
0 Kudos

Thank you for the prompt replied, it worked.

Answers (0)