Seems like I am trying to do roughly the same thing but I cannot get it to work.
I have a database table something like this:
Lead_id, user_id, date, status.
And of course a user table I will join with this one on the user_id. I want to group on the lead_id, and I want only the most recent date for that lead_id. I want to end up with something like this:
username, lead_id.
username, lead_id
etc.
I can use max(date) which gives me the right date but the username wont be the right one for the record with that date.
Does that make any sense?
I thought the HAVING clause would work but it doesnt seem to.