are you using sqlserver 2005 or later?try this:SELECT dets.[Crt_dt] , dets.[c_id]FROM ( SELECT t1.[Crt_dt] , t1.[c_id] , ROW_NUMBER () OVER ( PARTITION BY t1.[c_id] ORDER BY t1.[Crt_dt] DESC ) AS [RowRank] FROM c_attribute AS t1 ) AS detsWHERE dets.[RowRank] <= 3 -- AND dets.[c_id] = '62413036'ORDER BY dets.[c_Id] , dets.[RowRank] DESC
Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION