SELECT Row_Number() over (order by Id desc) SrlNo,* FROM [TU_LMS].[dbo].[ContentDetails] where DeptId=28 and createdBy=6 union SELECT Row_Number() over (order by Id desc) SrlNo ,* FROM [TU_LMS].[dbo].[ContentDetails] where DeptId=28 and createdBy !=6