• you could do something like this but I'm sure there's a faster way to return that query... this takes 30 secs to run on 30 groupings / 10k rows)... however the indexes are not optimized (90% of the work is done on scans and bookmark lookups).

    Select XType, id, name from dbo.ObjSQL O1 where PkObjSQL IN (Select TOP 2 PkObjSQL from dbo.ObjSQL O2 WHERE O2.XType = O1.XType Order by ID Desc)

    ORDER BY XType, id, name