tags:

views:

41

answers:

2

If I have a simple database table of names like so:

--------------
| NAME       |
--------------
| Andrew     |
| Bill       |
| Andrew     |
| Claire     |
| Claire     |
| Andrew     |
--------------

Is it possible to run a query that would produce a tally of the names? i.e.

-----------------------
| NAME       | COUNT  |
-----------------------
| Andrew     | 3      |
| Claire     | 2      |
| Bill       | 1      |
-----------------------
+9  A: 

Like this:

SELECT Name, COUNT(Name) FROM TABLE GROUP BY Name
SLaks
Thanks :) Almost too easy...
digiarnie
+3  A: 

You may want this to get the max:

    SELECT Name, COUNT(Name) AS c
      FROM TABLE
  GROUP BY Name
  ORDER BY c DESC
JoshD
Thanks for the order by
digiarnie