I stole this query below from this thread Retrieving the last record in each group :
SELECT m1.*
FROM messages m1 LEFT JOIN messages m2
ON (m1.name = m2.name AND m1.id < m2.id)
WHERE m2.id IS NULL;
Could someone please help me understand how AND m1.id < m2.id
returns the correct result/ I thought it should be AND m1.id > m2.id
which doesn't return correct result.
I'm sort of wondering technically id should be greater.