Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> How do I write an SQL query to do this?

How do I write an SQL query to do this?

From: D. Alvarado <laredotornado_at_zipmail.com>
Date: 14 Mar 2002 10:09:49 -0800
Message-ID: <9fe1f2ad.0203141009.39d5adb2@posting.google.com>


Hello,

   I'm pretty bad with SQL. However, I want to write a query that will sum all purchases for each purchaser. That is, given a simple table with the columns,

ID FIELD1 FIELD2 ... PURCHASES

--   ------   ------       ---------
1     xxx     xxx           100
2     xxx     xxx           75
1     xxx     xxx           50

I would like to obtain the results,

ID FIELD1 FIELD2 ... SUM(PURCHASES)

--  ------  ------         --------------
1    xxx      xxx           150
2    xxx      xxx           75

It is fairly straightfoward to sum for a particular id, but I'm not familiar enough with the syntax for each id.

Thanks for any help, Dave A. Received on Thu Mar 14 2002 - 12:09:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US