Good morning, so I have this simple example table
and, as the title says, I need to retrieve only the last (most recent) record for each ID, something like this:
I've tried with the GROUP BY clause, it seems to work when used alone, but when I join the resulting table with other tables it gives unwanted results. I'm using MySQL. I think it may be a bug, because it's a very strange behaviour.

