Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table column issues

Status
Not open for further replies.

kehers

Programmer
Joined
Aug 31, 2005
Messages
56
Location
A2
i av a table with a column containing categories some addresses belong to, occuring a number of times. i'd however luv to get each distinct category in the column with their number of occurence. As in something like this:
---------------+-----
CategoryNameA | 5
---------------+-----
CategoryNameB | 10
...
and so on.
How do i go about it?
 
use this:

Code:
select category_name
           , count(1)
        from table_name
    group by category_name

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top