[MYSQL] Select Unique Where Value Is Largest
Posted: Fri Mar 02, 2012 8:53 am
I have this table:

I want to select all fields where time is the highest value and conversation is unique so it returns these two rows:

My current SQL query doesn't give me the correct results that I'm looking for:
[text]SELECT * FROM `table` GROUP BY `conversation` ORDER BY `time` DESC[/text]

I need GROUP BY to select the unique row with the highest value in `time`.
How can I achieve this?

I want to select all fields where time is the highest value and conversation is unique so it returns these two rows:

My current SQL query doesn't give me the correct results that I'm looking for:
[text]SELECT * FROM `table` GROUP BY `conversation` ORDER BY `time` DESC[/text]

I need GROUP BY to select the unique row with the highest value in `time`.
How can I achieve this?
