Re: Lookup record with same id and match it's status

2009-01-11 Thread Baron Schwartz
You need to use a join. Specifically, a left outer join. I won't explain this in great detail; figuring out how this works can be your research topic ;) but try this: select a.id, a.from, a.to, a.message, a.insertdate, b.insertdate from messages as a left outer join messages as b on a.id =

Lookup record with same id and match it's status

2008-12-23 Thread sangprabv
Hi, I have a table which stores log traffic. The table contains these fields: transaction_id, from, to, message, status, insertdate For example there is a message from A send to B, when the message sent to B it will insert new record. And when the message is read by B, it will also insert new