Debt Consolidation - Find jobs - Cheap Cameras - High Paying Adsense List - Debt Consolidation

PDA

View Full Version : A mySQL query needed


KingCobra
May 16th 2009, 2:21 am
I have a table like this:

field1
-----
A
A
B
C
D
D
D
E

I want to make a query to produce a result like this:


A 2
B 1
C 1
D 3
E 1

that means I want to DISTRINCT field1 and count total row for particular letter.
What will be the query?

sw0rdfi5h
May 16th 2009, 2:27 am
select field1, count(field1) as totals from table1 group by field1;

KingCobra
May 16th 2009, 2:32 am
sw0rdfi5h ,

Thank You