Have warm wishes.
I have a table with lots of data and I need all data but the data that only updated last for example
Table
id - name - user_id - email
1 - abc - 1 - abc@email.com
2 - xyz - 2 - xyz@email.com
3 - abc - 1 - abc@email.com
4 - pqr - 3 - pqr@email.com
5 - abc - 1 - abc@email.com
6 - pqr - 4 - pqr@email.com
And now i queryu something like this
SELECT MAX(id),*
FROM `table`
GROUP BY user_id
ORDER BY id DESC
But it not returns expected output.my expected output is
id - name - user_id - email
5 - abc - 1 - abc@email.com
2 - xyz - 2 - xyz@email.com
4 - pqr - 3 - pqr@email.com
6 - pqr - 4 - pqr@email.com
The data inserted last only that will be shown. I refer this answer but it does not for getting all data. So how can I get all data that is inserted last when grouping id?