RE: Re: Select

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

 



Miguel Guirao wrote:

> You are right David, I have an auto_increment field!!
> 
> What about this:
> $items2 = mysql_query("SELECT DISTINCT rev FROM rev ORDER BY rev", $link);
> 
> where rev is a revision field for parts in my wharehouse!!!
> Does it will work in this case?
> 
> Thanks
> 
> -----Original Message-----
> From: David Robley [mailto:robleyd@xxxxxxxxxxxxxx]
> Sent: Martes, 17 de Mayo de 2005 03:42 p.m.
> To: php-db@xxxxxxxxxxxxx
> Subject:  Re: Select
> 
> 
> Miguel Antonio Guirao Aguilar wrote:
> 
>> 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?
> 
> Without knowing how many fields you have and what they are, no. But you
> should realise that DISTINCT looks at _all_ selected fields in a record,
> so if you have an auto_increment id field in amongst those selected, all
> the records will be different.
> 
> David
> 

That should work as you expect it to.

David

-- 
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