select count( overrideId ), ownerId, ownerType, bidMfrId, territoryId from tbl_BID_ManufacturersOverride where ownerId = and ownerType = and bidMfrId = group by ownerId, ownerType, bidMfrId, territoryId having count( overrideId ) > 1 select * from tbl_BID_ManufacturersOverride where ownerId = and ownerType = and bidMfrId = and territoryId = order by overrideId asc delete from tbl_BID_ManufacturersOverride where ownerId = and ownerType = and bidMfrId = and territoryId = and overrideId <>