SQL selection query question
Posted on 2011-02-27
I was wondering if anyone can tell me how to do the following using sql transact for sql server 2008.
I want to select all records in a couple of linked tables where UserId = @UserId AND ThreadId has to be the most recent one and has to be distinct.
For example user can have many threads but also a lot of messages on the same thread. On the main page I just want to see the most recent message in that thread plus all the other most recent message in different threads.