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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help needed with query

Status
Not open for further replies.

dognobbler

Programmer
Jul 4, 2003
46
0
0
GB
I have the following table which stores entries "content" submitted by users "submitname" about celebrities "celebname"


CREATE TABLE submit (
id int(10) NOT NULL auto_increment,
celebname varchar(50) default NULL,
content varchar(255) default NULL,
date_modified timestamp(10) NOT NULL,
submitname varchar(50) default NULL,
PRIMARY KEY (id)
)

The same "celebname" will appear many times as multiple entries will be made by multiple "submitnames".

What I need is a query which will tell me how many entries there are per "celebname". So it would look produce results something like thie

Celebname - No on entries
Madonna - 10
J-LO - 9
Tom Cruise - 3


Can anyone help me.

Andy

 
Try this:

Code:
SELECT   celebname, COUNT(*)
FROM     submit
GROUP BY celebname
ORDER BY celebname

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top