* Michelle de Beer > 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 > -----------------------
This is a basic GROUP BY query: SELECT headline, count(*) hits FROM headlinetable GROUP BY headline ORDER BY hits DESC <URL: http://www.mysql.com/doc/en/SELECT.html > <URL: http://www.mysql.com/doc/en/Group_by_functions.html > HTH, -- Roger --------------------------------------------------------------------- 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