select companyName, address, city, state, zipcode, mfrCustNum, count( operatorId )
from tbl_OPR_ClientOperators with (nolock)
where ownerId = 4036
and fsltablecode = 'DST'
and nullif( mfrCustNum, '' ) is not null
and nullif( fsl_choId, 0 ) is not null
group by companyName, address, city, state, zipcode, mfrCustNum having count( operatorId ) > 1
select listId from tbl_LST_PartnerLists with (nolock)
where ownerId = 4036
and ownerType = 'DST'
and listName = 'SYSCO DUPES'
insert into tbl_LST_PartnerLists ( ownerId, ownerType, listType, listName, partnerType, dateCreated, CreatedBy, Locked, isProcessing, sharedList )
values
(
4036,
'DST',
'CLIENT',
'SYSCO DUPES',
'OPR',
,
-1,
'N',
'N',
'N'
)
select distinct fsl_choId
from tbl_OPR_ClientOperators opr with (nolock)
where ownerId = 4036
and fsltablecode = 'DST'
and companyName =
and address =
and city =
and state =
and zipcode =
and mfrCustNum =
select operatorId
from tbl_OPR_ClientOperators opr with (nolock)
where ownerId = 4036
and fsltablecode = 'DST'
and companyName =
and address =
and city =
and state =
and zipcode =
and mfrCustNum =
insert tbl_LST_PartnerListItems values
( , )