+3  A: 

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 at the same time

Zed
Your answer is almost perfect, you just need to put the `as ds` outside the parenthesis.
Blackethylene
Thanks, fixed.
Zed
A: 

Hi i hope this gives what u want it

select deal_id,status_id, timestamp 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 order by deal_id
boss