Selecting all corresponding fields using MAX and GROUP BY
without a single primary key field, I think your best bet is: select * from deal_status inner join (select deal_id as did, max(timestamp) as ts from deal_status group by deal_id) as ds on deal_status.deal_id = ds.did and deal_status.timestamp = ds.ts this still won’t work if you allow having two different statuses for the same product … Read more