A Simple SQL Statement
Date: 1997/10/21
Message-ID: <877416656.16852_at_dejanews.com>#1/1
Can someone help me solve this simple problem ? There are two tables,
and
I
need a summary of the items. For SUM(SD_QTY) I get the right figure,
but
for
SUM(PD_QTY) I get the figure multiplied by 3.
FROM SALES_DETAILS, PURCHASE_DETAILS
WHERE SD_ITEM = PD_ITEM (+)
GROUP BY SD_ITEM;
----------------------- Result --------------------------
SD_ITEM Sum(SD_QTY) Sum(PD_QTY)
3 104 6 <-------- This should be
2
4 200
SB 1
----------------------- Thank you in advance -------------------
PD_ITEM PD_QTY
3 2
SD_ITEM SD_QTY
3 100
3 1
3 3
4 200
SB 1
---------------------- S Q L --------------------------------
SELECT SD_ITEM, SUM(SD_QTY), SUM(PD_QTY)
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Tue Oct 21 1997 - 00:00:00 CEST