For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2005 > Select









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Select
Miguel Antonio Guirao Aguilar

2005-05-17, 3:56 am

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

2005-05-17, 3:55 pm

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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com