Skip to Content
0
Apr 14, 2016 at 02:07 AM

Query To Check Sales Of Product Based On Item Group

252 Views

Hello Experts

I am trying to write a query that will display all products that have been sold

The results should only displays rows where the item code belongs to Item Group PFL240

I have written a query, but it shows all products. Even ones that don't belong to the item group

SELECT

T1.[DocNum],

T1.[DocDate],

T1.[CardCode],

T1.[CardName],

T0.[ItemCode],

T0.[Dscription],

T0.[U_Colour_Code],

T0.[U_Colour_Desc],

T0.[Quantity],

T1.[U_Desc]

FROM RDR1 T0 INNER JOIN ORDR T1 ON T0.[DocEntry] = T1.[DocEntry], OITB T2

WHERE T2.[ItmsGrpNam] = 'PFL240'

GROUP BY

T1.[DocNum],

T1.[DocDate],

T1.[CardCode],

T1.[CardName],

T0.[ItemCode],

T0.[Dscription],

T0.[U_Colour_Code],

T0.[U_Colour_Desc],

T0.[Quantity],

T1.[U_Desc]

ORDER BY T1.[DocDate]

Can anyone please help on where i am going wrong?

Thanks

Kind Regards

Rahul