Posted by Bill Karwin on 03/03/06 02:16
"Thomas Kellerer" <WVIJEVPANEHT@spammotel.com> wrote in message
news:46petmFc69qnU1@individual.net...
> SELECT *
> FROM playback_log a
> WHERE a.event_id = (select min(event_id) from playback_log b
> where a.field1 = b.field1)
Here's a similar possibility, without using a correlated subquery:
SELECT a.*
FROM playback_log AS a
WHERE a.event_id IN (
SELECT MIN(b.event_id)
FROM playpack_log AS b
GROUP BY b.field1, b.field2, b.field3, ...)
What I've seen missing in the several solutions proposed is any use of GROUP
BY. You'll need to GROUP BY all the fields of the table _except_ for
event_id.
Regards,
Bill K.
[Back to original message]
|