Michelle,
Tuesday, December 03, 2002, 2:27:00 PM, you wrote:

MdB> I have a column containing headlines. In this column
MdB> there are some duplicates, like this:
MdB> -----------
MdB> monsters
MdB> headline1
MdB> monsters
MdB> halloween
MdB> monsters
MdB> halloween
MdB> ...
MdB> ----------

MdB> How can I get a result like this instead?
MdB> HEADLINE   | HITS
MdB> -----------------------
MdB> monsters   | 3
MdB> halloween  | 2
MdB> headline1  | 1
MdB> -----------------------

SELECT headline, COUNT(*) as hits FROM table_name GROUP BY headline



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.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

Reply via email to