Sunteți pe pagina 1din 1

SELECT DISTINCT T0.[DocNum], T0.[PlannedQty], T0.[CmpltQty], T1.[Dscription], T0.[PostDate], (T1.[StockPrice]*T0.[CmpltQty]) as 'Actual Product Cost', ( Select sum(A.

[LineTotal]) from A ige1 where a.baseref=t0.docnum) as 'Actual Component Cost' FROM OWOR T0 LEFT JOIN IGN1 T1 ON T0.[DocNum]=T1.[BaseRef] LEFT JOIN IGE1 T2 ON T0.[DocNum]=T2.[BaseRef] WHERE T0.[PostDate] >=[%0] AND T0.[PostDate] <=[%1] GROUP BY T0.[DocNum], T0.[PlannedQty], T0.[CmpltQty], T1.[Dscription], T0.[PostDate], T1.[StockPrice],T0.[CmpltQty]

see the above red line I want to put a condition there i.e. sum(T2.[LineTotal]) where T0.[DocNum]=T2.[BaseRef]

please give me syntax

S-ar putea să vă placă și