So suppose I have a bunch of blog entries and I want to find out the most recent comment in each of them, how would I go about finding that out in SQL Server.
I have a list of integer id's of these blog entries in a temp table. Something like select top 1 does not work in this case.
The approach coming to my mind is looping, and we all know how much people prefer to avoid loops in SQL Server.