I have the following table: messages: if: from_user_id: to_user_id: body: created_at: updated_at:
I have to return all the rows that have a distinct from_user_id based on a to_user_id. Not only that but I want to return the rows with the newest created_at. I thought this would work: SELECT DISTINCT to_user_id, created_at FROM messages WHERE to_user_id = 1 ORDER BY created_at; But the problem is that I only get distincts when I only have to_user_id in the SELECT clause. Any suggestions. I need to return everything on the latest row that has a distinct from_user_id :-). -- John Kopanas [EMAIL PROTECTED] http://www.kopanas.com http://www.cusec.net http://www.soen.info -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]