One idea that occurs to me, and it's a tradeoff from Torsten's idea (which
is to read the whole database, and parse out the unique rows), is to first
execute your "SELECT DISTINCT distinct_col FROM table", and then walk
through that, and for each one issue a "SELECT * FROM table WHERE
distinct_col = {value} LIMIT 1"  (For some reason I can't remember the
'LIMIT' syntax right now, so it might be LIMIT 0,1).  More transactions with
the database, but less data actually retrieved from the database.  And if
it's indexed by distinct_col, you should be fine.

Added benefit:  you can apply arbitrary ORDER BY mechanisms to the
individual queries... so it will only show you the most recent, or the
first, or a random entry... all up to you.


---- Original Message
"Lars Hilsebein" <[EMAIL PROTECTED]> wrote in message
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
As it would happen when I do the query "SELECT DISTINCT distinct_col FROM
But I need to fetch the whole row.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to