RE: [PHP-DB] Select

From: Date: Tue, 17 May 2005 06:17:43 +0000
Subject: RE: [PHP-DB] Select
Groups: php.db 
Request: Send a blank email to php-db+get-39468@lists.php.net to get a copy of this message
Hi, Instead of doing a SELECT *, specify the fields that you require. Allthough you may think the rows are exactly the same, one might be empty ("") and one null which is not the same. You are more likely to get the result that you need if you specify the fields: SELECT DISTINCT somedata, rev, andthis FROM rev ORDER BY rev By the way, having "rev" as a name for your table AND as a fieldname is confusing and not advisable. Rgds, Jos -----Original Message----- From: MIGUEL ANTONIO GUIRAO AGUILAR [mailto:miguel.guirao@mail.telcel.com] Sent: 17 May 2005 04:26 To: php-db@lists.php.net Subject: [PHP-DB] Select Hi!! I have this query in PHP: $items2 = mysql_query("SELECT DISTINCT * FROM rev ORDER BY rev", $link); I have three rows with the same data on it, and DISTINCT seems to be not working, since I got all the rows, any ideas of what is going wrong? -------------------------- MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#39468) next »