|ID | Revision | Title | ------------------------- | 1 | 1 | Foo1 | | 2 | 2 | Foo2 | | 3 | 3 | Foo3 | | 4 | 2 | Foo4 | | 5 | 1 | Foo5 | | 6 | 1 | Foo6 |
So heres the dilemma, try as i might im stuck with this one, i am trying to return the greatest id row data for each revision ( e.g. return row ID 6 for revision 1, 4 for revision 2, 3 for revision 3 ), anyone kind enough to able to help with this one? I was able to return the correct ID using MAX() but the rest of the row data wasn't correct ( e.g. Title was incorrect ).
This doesn't work,
SELECT max(id) as id, title FROM blog GROUP BY revision ORDER BY id ASC