Re: Make GROUP BY select entries i want Ralph wrote:
> Is there a way to tell group by to group by lets say user_id and to
> choice the entry where login_time is most recent?
Maybe you need to run GROUP BY on your newsgroup posts, too. ;-)
No, there's no way to tell GROUP BY to resolve the ambiguity for you.
Here's a solution for the question you asked:
SELECT t1.*
FROM tablex AS t1 LEFT JOIN tablex AS t2
ON t1.user_id = t2.user_id AND t1.login_time < t2.login_time
WHERE t2.login_time IS NULL
Regards,
Bill K. |