Click to See Complete Forum and Search --> : Dogs


bokeh
07-28-2006, 07:17 AM
SELECT COUNT(*) as `quantity` FROM `dogs` WHERE `breed` = 'chihuahua'

How would I change that query to return multiple non-specified dogs i.e. whatever the table may contain at the time:

newfoundland => 5
poodle => 4
shepherd => 7
etc = >1
???

chazzy
07-28-2006, 08:06 AM
SELECT COUNT(*) as quantity, breed FROM dogs GROUP BY breed, order by quantity;

bokeh
07-28-2006, 08:26 AM
Why didn't I think of that? Thanks!