Was this helpful?
1 vote
|
Our Conversation table maintains many message threads. Each thread between two users has a unique id, and every time a new message is added to the thread, the message number get incremented by 1. Here is the table with some simple data.
I want to retrieve the last message of each thread in a single SQL query. Based on the above data the result set should contain this:
Essentially these are the last messages (with MAX messageid) in each thread. Is this possible in SQL? If so, what does this look like? |
asked | Apr 07, 2016 |
viewed | 305 times |
active | Apr 07, 2016 |