cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Could someone please tell me what i need to do to add another column to this query that i have, i wa

dku242
Explorer
0 Kudos
245

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]

Accepted Solutions (0)

Answers (0)