I have a table called history with the fields id, lastname, event and date.
It saves events of persons that works in my office like "Entering office", "Exiting office", "Illness", "Holidays", etc.
I need to get the last event of every person.
This is what I tried but it doesn't work:
SELECT lastname, event, max(date)
FROM personshistory
GROUP BY lastname, event;