thanks,

T. Hiep



On Tue, 13 Nov 2007, Baron Schwartz wrote:

Hi,

Hiep Nguyen wrote:
hi there,

this seems so easy, but i'm out of sql for a long time and need help

i have:

id,amount,state
1,2.00,il
2,2.00,oh
3,1.00,il
4,1.00,ks
5,3.00,ks
6,4.00,oh


how do i construct a sql statement that results as following:

il,3.0
oh,6.0
ks,4.0

sum (amount) all the same state.

Try this:

select state, sum(amount) from tbl group by state;


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to