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 - [email protected]
2 - xyz - 2 - [email protected]
3 - abc - 1 - [email protected]
4 - pqr - 3 - [email protected]
5 - abc - 1 - [email protected]
6 - pqr - 4 - [email protected]
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 - [email protected]
2 - xyz - 2 - [email protected]
4 - pqr - 3 - [email protected]
6 - pqr - 4 - [email protected]
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?