Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: I'm stumped... tough JOIN...


Message #1 by "Arbon Reimer" <arbon@l...> on Tue, 12 Feb 2002 16:25:12 -0700
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1B42C.DF745B70
Content-Type: text/plain;
	charset="iso-8859-1"

Try this:

SELECT SUM(P.PO_TOTAL) AS PO_TOTAL,
SUM(E.EO_AMOUNT) AS EO_TOTAL,
SUM(E.EO_AMOUNT + P.PO_TOTAL) as COMBINED_TOTAL,
V.VENDOR_NAME, P.VENDOR_NUMBER, E.VENDOR_NUMBER
FROM Vendors V
    LEFT OUTER JOIN vwEOTotals E ON
    E.VENDOR_NUMBER = V.VENDOR_NUMBER
    LEFT OUTER JOIN vwPOTotals P ON
    P.VENDOR_NUMBER = V.VENDOR_NUMBER
GROUP BY V.VENDOR_NAME, P.VENDOR_NUMBER, E.VENDOR_NUMBER

If this doesn't get you there, let me know I and will write something with
sub queries.

regards
David Cameron
nOw.b2b
dcameron@i...


  Return to Index