on 2024 May 07 9:21 PM
Can somebody please help me to add a new column to a query that i have already. I want to add a column to show "the last purchase price" The query i have currently is as follows. Any help would be much appreciated.
Thankyou in advance.
SELECT T0.[ItemCode], T1.[ItemName], T0.[OnHand], T0.[OnOrder], T0.[IsCommited] as 'Sales BOs'
, ISNULL((select Sum( T3.[Quantity]) FROM OINV T2 INNER JOIN INV1 T3 ON T3.[DocEntry] = T2.[DocEntry]
WHERE T0.Itemcode = T3.Itemcode and (T2.[DocDate] >= [%0] and T2.[DocDate] <= [%1])),0) as 'QTY Sold in Period'
, ISNULL((select Sum( T5.[Quantity]) FROM ORIN T4 INNER JOIN RIN1 T5 ON T5.[DocEntry] = T4.[DocEntry]
WHERE T0.Itemcode = T5.Itemcode and (T4.[DocDate] >= [%0] and T4.[DocDate] <= [%1])),0) as 'QTY Returned In Period'
FROM OITW T0 INNER JOIN OITM T1 ON T0.[ItemCode] = T1.[ItemCode] and T1.[DfltWH] = '01' and T0.[WhsCode] = '01'
Where T1.[ItemCode] >= [%3] and T1.[ItemCode] <= [%4]
Request clarification before answering.
| User | Count |
|---|---|
| 22 | |
| 19 | |
| 14 | |
| 9 | |
| 6 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.