Re: most occured word - but without search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try something like

SELECT person_name, COUNT(person_name) AS name_count
FROM table_name
GROUP BY person_name
ORDER BY name_count DESC
LIMIT 1

That should give you the most commonly occuring name
-- 
Kind Regards

Giles Smith
Project Engineer
(dir) 0870 421 1585
(f) 0870 458 4545

"The UK's Best Hosting Provider" ISPA Awards 2007, 2006 and 2005

Dedicated Servers - Managed Hosting - Domain Names- http://www.ukfast.net

UKFast.Net Ltd, City Tower, Piccadilly Plaza, Manchester, M1 4BT
Registered in England. Number 384 5616

Please consider the environment. Do you really need to print this email?

Imran wrote:
> 
> 
> Dear Friends,
> 
> Is there any MySQL query that could find the most occured word in a column
> of a table, without searching it?
> 
> e.g.,
> 
> *Column Name*
> - - - - - - - - - - -
> John
> James Bond
> John
> Alix
> Philips
> John
> - - - - - - - - - -
> 
> So, without search, we want to see that John has occured 3 times.
> 
> Sql Query is appreciated.... if possible?
> 
> Thanks v.much,
> Imran
> 
> [Non-text portions of this message have been removed]
> 
> 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux