List:General Discussion« Previous MessageNext Message »
From:Jeremy Cole Date:November 22 2005 4:38pm
Subject:Re: Getting no of different rows by group by clause
View as plain text  
Hi Abishek,

> I want the output as:
> LHR 3
> AKL 2
> AWL 1

This should do it:

SELECT name, COUNT(*) as num
FROM tab_name
GROUP BY name
ORDER BY num DESC

Regards,

Jeremy

-- 
Jeremy Cole
MySQL Geek, Yahoo! Inc.
Desk: 408 349 5104
Thread
Getting no of different rows by group by clausemail@ejain.com22 Nov
  • Re: Getting no of different rows by group by clauseJeremy Cole22 Nov
  • Re: Getting no of different rows by group by clausePeter Brawley22 Nov
  • Re: Getting no of different rows by group by clauseRhino22 Nov