Re: quick question

From: Date: Tue, 09 Oct 2001 21:27:53 +0000
Subject: Re: quick question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-70537@lists.php.net to get a copy of this message
> Hello Jeremy, > > use 'GROUP BY username' in your query and will combine all records > with same username into one record. More effecient way is to use distinct, ie SELECT DISTINCT username .... group by has the same effect, but is slower. It does however have the advantage that you can use count, max, etc. HTH,Tom > > /Merle > > Tuesday, October 09, 2001, 2:05:11 PM, you wrote: > > JM> Hi everyone, > > JM> just forgot how to do something.... > > > > JM> I would like to query the records where the "username" is different. In my > JM> table a lot of them are Identical and I only want them once in my result > > > JM> $connection = @mysql_connect("localhost", "hpool", > JM> "cdi986") or > JM> die("Couldn't connect."); > > JM> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select > JM> database."); > > JM> $sql = "SELECT uid, username > JM> FROM users > JM> "; > > JM> $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); > > JM> Thank You. > > > > -- > 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 >

« previous php.general (#70537) next »