![]() |
|
|
+ Search |
![]()
|
Jul 31st, 2000 13:00
John Marc, deno vichas,
Suppose you had a table with fields custid,due,state Now, you want a unique list of states, but also the TOTAL amount due from each state. SELECT sum(due), state FROM table GROUP BY STATE. The group by is what you are looking for. Note, you can use more than one field as in: GROUP BY city,state to widen the uniqueness to the city level, but avoid lumping Paris, texas with Paris, NY