select distinct operatorOwnerId, operatorOwnerType from tbl_1FS_MappingQueue where nullif( linkId, 0 ) is null group by operatorOwnerId, operatorOwnerType, operatorId having count(operatorId) > 1 select operatorId, count(operatorId) from tbl_1FS_MappingQueue where operatorOwnerId = and operatorOwnerType = and nullif( linkId, 0 ) is null group by operatorId having count(operatorId) > 1 delete from tbl_1FS_MappingQueue where operatorOwnerId = and operatorOwnerType = and operatorId = and operatorId not in ( select top 1 queueId from tbl_1FS_MappingQueue where operatorOwnerId = and operatorOwnerType = and operatorId = order by linkId desc, queueDate )

COMPLETED!