Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

turnover from date to date per customer and item

Hello experts,

is it possible to unite these 2 queries into 1?

1/SELECT T0.ItemCode, Max(T0.Dscription) 'Item Discription', T1.CardCode, Max(T1.CardName) 'Customer Name', SUM(T0.Quantity) 'Turn Over'

FROM dbo.INV1 T0

INNER JOIN dbo.OINV T1 on T1.DocEntry = T0.DocEntry

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

GROUP BY T0.ItemCode, T1.CardCode

ORDER BY T0.ItemCode, T1.CardCode

2/SELECT T0.ItemCode, Max(T0.Dscription) 'Item Discription', T1.CardCode, Max(T1.CardName) 'Customer Name', SUM(-T0.Quantity) 'Turn Over'

FROM dbo.rin1 T0

INNER JOIN dbo.Orin T1 on T1.DocEntry = T0.DocEntry

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

GROUP BY T0.ItemCode, T1.CardCode

ORDER BY T0.ItemCode, T1.CardCode

1/+2/ ?

Thank you in advance,

Martina

Former Member
Not what you were looking for? View more on this topic or Ask a question