Page 1 of 1

SQL Grouping Problem

Posted: Tue Jul 17, 2007 2:44 am
by zeenat khan
Dear SQL Champs,

I have two columns like this

Id column a column b
1 a 10000
2 z 20000
3 i 30000
4 z 40000
5 p 50000
6 d 60000
7 a 70000
8 p 80000
9 i 90000

Find the query which will sum the column b, group by column a without disturbing the sequence
Out put should be as follows

A 80000
Z 60000
I 12000
P 13000
D 6000

Posted: Tue Jul 17, 2007 2:54 am
by ahmadbilal
select cola,sum(colb)
from table_name
group by cola