44
I have the following table called questions:
ID | asker
1 | Bob
2 | Bob
3 | Marley
I want to select each asker only once and if there are multiple askers with the same name, select the one of the highest id. So, the expected results:
ID | asker
3 | Marley
2 | Bob
I use the following query:
SELECT * FROM questions GROUP by questions.asker ORDER by questions.id DESC
I get the following result:
ID | asker
3 | Marley
1 | Bob
It selects the first 'Bob' it encounters instead of the last one.