Could someone please help me understand the following query. Im finding difficulty relating it :-( Pls Help!
select * from cbpartner where CBPartner.IsSummary='N' and salesrep_id in
(select distinct(aduserid) from aduserroles where aduserid=1000005 and adroleid = 1000005)
and isCustomer='Y' or ((salesrepid is not null or salesrepid is null) and Exists (select 'true' from aduserroles where adroleid != 1000005 and adroleid =1000002 and aduserid =1000005))