Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Having two tables each with Quantity out of which I want to check Sum from one t

The below is the one which I've tried. But I don't know how to frame it properly. I'm getting error in this query. Can someone please help me?

Select
ORD_DetailLineID as PID_SODetailLineID, 0 as PID_DetailLineID, ORD_ItemLineNumber as PID_SOSerialNumber,
'False' as PID_ToPrint, ORD_PartCode as PID_PartCode, ORD_PartDescription as PID_PartDescription,
ORD_UOM as PID_UOM, ORD_DeliveryDate as PID_DeliveryDate, ORD_ArrivalDate as PID_ArrivalDate,
ORD_Quantity as PID_Quantity, ORD_UnitPrice as PID_UnitPrice, ORD_Amount as PID_Amount
From
TRN_OrderReceiveDetail
Where
ORD_HeaderID=551 And ORD_DetailLineID Not In
(Select PID_SODetailLineID From TRN_ProformaInvoiceDetail A Full Outer Join TRN_OrderReceiveDetail B
On B.ORD_HeaderID = 551 And A.PID_SODetailLineID = B.ORD_DetailLineID
Group By A.PID_SODetailLineID Having SUM(A.PID_Quantity) < B.ORD_Quantity)

With Regards,
Arunagiri GT
[1003 byte] By [arunagiri_gt] at [2007-11-11 10:09:24]