Forum Moderators: open

Message Too Old, No Replies

How to take the count

         

shaan1980

6:57 pm on Mar 24, 2006 (gmt 0)

10+ Year Member



I have a database

ID AlPHA
x A
x B
x C
y T
y Y
y N
y Q

I want to write an SQL that gives me the distinct ID and the count of column ALPHA

In this case I want the response to be

x 3
y 4

txbakers

7:04 pm on Mar 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



select id, count(id) order by id group by id