Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

SELECT * FROM table WHERE column = (SELECT MAX(column) FROM table)

Documents (simplified version):

What is the most efficient way to select one row per ID with the highest 'rev' value?

Using MySQL, the query should return two rows with the data [1, 3, ...] and [2, 1, ...] from the above information.

I use checks in the while loop to detect and over-write old revs from the resultset. But is this the only method to achieve the result? Isn't there a SQL solution?

Sign In or Register to comment.