Re: fetch row DISTINCT

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

 



>"Lars Hilsebein" <lars.hilsebein@xxxxxxxxxxxxxx> wrote in message
news:60D21430A600D61193B30050DA5C4E370F1F37@xxxxxxxxx
>Sorry, but it's not truly what I am searching for:
>The result is not unique.
>What I mean is: every entry in the distinct_col should only be delivered
>once.
>As it would happen when I do the query "SELECT DISTINCT distinct_col FROM
>table".
>But I need to fetch the whole row.
>
>Lars

Hi Lars,

the problem is that MySQL doesn't know *which* row to select because if you
use distinct it means there are several rows with this value in
distinct_col. Maybe you should try filtering the results in PHP.

You could create an array with the distinct value as the key and the whole
row as the value. Then on each loop iteration check if you already have a
row in your array with the current distinct_col value.

Regards, Torsten Roehr

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