select distinct opr.lastImportSource, opr.recordsource, opr.ownerId, opr.fsltablecode, opr.operatorId, oprQ.queueId as oprQueueId, oprQ.linkId as oprLinkId from tbl_OPR_ClientOperators opr with (nolock) left outer join tbl_1FS_MappingQueue oprQ with (nolock) on oprQ.operatorOwnerId = opr.ownerId and oprQ.operatorOwnerType = opr.fsltablecode and oprQ.operatorId = opr.operatorId where opr.ownerId = and opr.fsltablecode = and nullif( opr.fsl_choId, 0 ) is null and opr.crmActive = 'Y' and ( opr.recordSource not like '%Trade Management%' and opr.recordSource not like '%Blacksmith%' ) and not exists ( select items.partnerId from tbl_LST_PartnerLists list with (nolock) inner join tbl_LST_PartnerListItems items with (nolock) on items.listId = list.listId where list.ownerId = opr.ownerId and list.ownerType = opr.fsltablecode and list.listName = 'DO NOT ADD' and items.partnerId = opr.operatorId ) and opr.operatorId not in ( ) and opr.operatorId not in ( ) Operators with neither:

select listId from tbl_LST_PartnerLists with (nolock) where ownerId = and ownerType = and listName = 'Gerry to Review' insert into tbl_LST_PartnerLists ( ownerId, ownerType, listType, listName, partnerType, dateCreated, CreatedBy, Locked, isProcessing, sharedList ) values ( , , 'CLIENT', 'Gerry to Review', 'OPR', , -1, 'N', 'N', 'N' ) insert into tbl_1FS_MappingQueue ( queueDate, operatorOwnerId, operatorOwnerType, operatorId, linkLevel, mapCompanyType, listName ) values ( , , , , , , ) insert into tbl_LST_PartnerListItems values ( , )