2021年3月21日星期日

Find all records which contain certain string at the latest date

I have a table with change history for orders

 cart_id     date                    action   1           01/01/2020 3:00         approved   1           01/01/2020 2:00         saved   2           02/03/2020 9:00         saved   2           02/03/2020 5:00         created  

I need to get a list of all cart IDs where the latest action was "saved". So in this case it would return only cart ID 2 because "saved" was the latest action, whereas the latest action of cart ID 1 was "approved". I'm not really sure where to start here, any way I can achieve this?

https://stackoverflow.com/questions/66739098/find-all-records-which-contain-certain-string-at-the-latest-date March 22, 2021 at 08:55AM

没有评论:

发表评论