Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How do I write an SQL query to do this?
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
![]() |
![]() |