how do i count() similar items

From: jackassplus <jackassplus(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how do i count() similar items
Date: 2010-09-08 15:03:47
Message-ID: bcdbbc50-fda4-47a8-b7f8-efe3f86bdc98@n19g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

lets say I hve the following in the 'fruits' table:

Round orange
Sunkist orange
navel orange
strawberry
blueberry
sunkist orange
apple

how would I get something like the following:

count as c | Fruit type
---------------------------------
4 | orange
2 | berry
1 | apple

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Wild 2010-09-08 15:40:25 Re: Empty SELECT result at simultaneous calls
Previous Message Sam Mason 2010-09-08 09:52:03 Re: joins with text search