Re: largest number of entries

From: Date: Sun, 08 Oct 2000 21:24:14 +0000
Subject: Re: largest number of entries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19116@lists.php.net to get a copy of this message
Hi tyler, SQL group by should help something like select name, count(*) from contacts_table group by name HTH Steve At 3:40 PM -0700 8/10/00, Tyler Longren wrote:
Hey everybody, Let's say that I have a mysql table, inside this table, there is a field named 'name'. And let's say there are 10 different names in that field, each in a different row. If the name 'Tyler' is in there 5 times, the name 'Ronald' is in there 9 times, the name 'Vic' is in there 12 times, the name 'Kristin' is in there 6 times, and the name 'Paul' is in there 8 times. That's 5 names, the other 5 names in there are only listed 1 time. How could I get the 5 highest entries? which would be: Vic - 12 Ronald - 9 Paul - 8 Kristin - 6 Tyler - 5 ??? That was pretty darn unclear, so if you don't understand what I mean, just forget about it. :) Thanks, Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- --------------------------------------------------- "I disagree completely with what you are saying, but I will defend to the death your right to say it" - Voltaire Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: hts@hts.com.au Tel: 612 9982 6767 Fax: 612 9981 3081

« previous php.general (#19116) next »