SELECT DISTINCT(player2) FROM logs
WHERE player1=3
ORDER BY time DESC
Would it be possible to return other non-distinct cols with that query?
Or my other solution:
SELECT * FROM logs
WHERE player1=3
GROUP BY player2 ORDER BY time DESC
This works fine but it does not order properly. It picks the first one of the group.
Table example:
player1 player2 time
3 5 1
3 5 2
3 6 3
I would expect it to return:
player2 time
5 2
6 3
But it returns (with group by):
player2 time
5 1
6 3
Try this: