select
ID
from
CRMCampaignBlackList
where
(
(Firm_ID is Null and :Firm = '0000000000') or
((:Firm <> '0000000000' and (Firm_ID in (select ID from Firms where ID=:Firm OR Firm_ID=:Firm))))
) and
((Person_ID is Null and :Person = '0000000000') or (:Person <> '0000000000' and Person_ID = :Person)) and
((FirmOffice_ID is Null and :FirmOffice = '0000000000') or (:FirmOffice <> '0000000000' and FirmOffice_ID = :FirmOffice)) and
(EmailAddress = :EmailAddress) and
(Hidden = 'N')Generated by ABRA Software a.s. 27.10.2021 16:34:54