MySQL Forums
Forum List  »  Newbie

Re: How to select last event from a related table
Posted by: Peter Brawley
Date: May 13, 2021 01:11PM

Is this what you mean?

select order_id, max(created_at) as last_event
from events e
join orders o on e.order_id=o.id
group by order_id
order by order_id;

Options: ReplyQuote


Subject
Written By
Posted
Re: How to select last event from a related table
May 13, 2021 01:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.