RE: Select

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

 



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@xxxxxxxxxxxxxxx]
Sent: 17 May 2005 04:26
To: php-db@xxxxxxxxxxxxx
Subject:  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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux