Re: Getting no of different rows by group by clause

2005-11-22 Thread Rhino
ing no of different rows by group by clause Hi Friends, I have a table like name MAD LHR MAD LHR AKL AWL AKL LHR I want the output as: LHR 3 AKL 2 AWL 1 etc... ie the no of entires sorted by their no of appearences. I cannot do that by select name from tab_name group by name as it will not g

Re: Getting no of different rows by group by clause

2005-11-22 Thread Peter Brawley
Abhishek >I want the output as: >LHR 3 >AKL 2 >AWL 1... >ie the no of entires sorted by their no of appearences. SELECT tbl.name AS Name, COUNT( tbl.name) AS Count FROM tbl GROUP BY tbl.name ORDER BY Count DESC; PB [EMAIL PROTECTED] wrote: Hi Friends, I have a table like name MAD LHR

Re: Getting no of different rows by group by clause

2005-11-22 Thread Jeremy Cole
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 -- MySQL General Mailing List For list archives: http://lists.mysql.c

Getting no of different rows by group by clause

2005-11-22 Thread [EMAIL PROTECTED]
Hi Friends, I have a table like name MAD LHR MAD LHR AKL AWL AKL LHR I want the output as: LHR 3 AKL 2 AWL 1 etc... ie the no of entires sorted by their no of appearences. I cannot do that by select name from tab_name group by name as it will not give me the no of rows. Pl. help me to find i