SELECT headline, count(*) AS HITS from your_table GROUP BY headline

> -----Original Message-----
> From: Michelle de Beer [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 03, 2002 8:27 AM
> To: mysql list
> Subject: Select and count duplicates
> 
> 
> I have a column containing headlines. In this column
> there are some duplicates, like this:
> -----------
> monsters
> headline1
> monsters
> halloween
> monsters
> halloween
> ...
> ----------
> 
> How can I get a result like this instead?
> HEADLINE   | HITS
> -----------------------
> monsters   | 3
> halloween  | 2
> headline1  | 1
> -----------------------
> 
> Any thoughts?
> // Michelle
> 
> <Sql query>
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now. 
http://mailplus.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to