Newbie question:
I've got an email message table that's got a message_id field (primary key field) and other fields like body, receiver_id, sender_id and parent_id. The parent_id field is what connects messages of the same thread together when user replies to a message.
Right now i have a simple query that looks up all the messages under a specific reciever_id and returns them. The problem is I want to also check to see if 2 or more messages have got the same parent_id and if so, i only want the most recent messsage returned.
Can anyone shed some light on this?
I thought about using a CASE statment but wasn't sure where to start.