Skip to Content
0
Former Member
Jul 02, 2009 at 07:07 AM

Issued qty - query

254 Views

Hi all.

I'm currently trying to make a query of total issued quantity from production of certain items. It is supposed to give me 3 things;

1. Item code of issued items

2. Issued quantity

3. Total item cost of the issued quantity

I think I have managed to solve the first 2 points on the list - but I'm struggling with the third. I'm not sure from where to get the correct item cost (price) for the issued items.

Can someone please lend me a hand? here is how my query looks now:

SELECT T1.[ItemCode], SUM(T1.[IssuedQty]) as 'Issued Qty' 
FROM [dbo].[OWOR]  T0 INNER JOIN [dbo].[WOR1]  T1 ON T0.DocEntry = T1.DocEntry 
INNER JOIN [dbo].[OITM]  T2 ON T1.ItemCode = T2.ItemCode 
WHERE T1.[ItemCode] Like 'R%%' OR  T1.[ItemCode] Like 'S%%' 
AND  T0.[PostDate] between [%1] AND [%2] 
GROUP BY T1.[ItemCode] 
ORDER BY T1.[ItemCode]

Appreciate all help.

Kind regards,

Runar Wigestrand.