Hello.
I have the following code. Which I can't get it to work.
All of the code works until I get to the OR statements.
Not sure if I need a case statement or ?
Any input would be much appreciated !
Thanks.
select a.agree_no as agreement_no,
a.um_agree_no as umbrella,
a.agree_class as classification,
a.agree_desc as description,
a.end_dat as enddate,
b.deleted as deleted1
from p_pricing.agreement_renewal_v1 b, p_master.agreement_v1 a
where a.agree_no = b.agree_no
and a.end_dat > '20200624'
and b.deleted is NULL
and a.agree_type IN ('ZDRB', 'ZCRB', 'ZDTI', 'ZCTI', 'ZCTD', 'ZDTD', 'ZDRC')
and a.sales_org_hdr <> '1002'
and a.sales_org_hdr <> '2002'
and a.agree_class ='ZG' and a.agree_desc not like 'GA-%' and a.end_dat > '20200624'
or a.agree_class ='ZC' and a.agree_desc not like 'CA-%' and a.end_dat > '20200624'
or a.agree_class = 'ZP' and a.agree_desc not like 'PA-%' and a.end_dat > '20200624'
or a.agree_class = 'ZMCA' and a.agree_desc not like 'MCA-%' and a.end_dat > '20200624'
group by a.agree_no, a.um_agree_no, a.agree_class, a.agree_desc, a.end_dat, b.deleted
I have the following code. Which I can't get it to work.
All of the code works until I get to the OR statements.
Not sure if I need a case statement or ?
Any input would be much appreciated !
Thanks.
select a.agree_no as agreement_no,
a.um_agree_no as umbrella,
a.agree_class as classification,
a.agree_desc as description,
a.end_dat as enddate,
b.deleted as deleted1
from p_pricing.agreement_renewal_v1 b, p_master.agreement_v1 a
where a.agree_no = b.agree_no
and a.end_dat > '20200624'
and b.deleted is NULL
and a.agree_type IN ('ZDRB', 'ZCRB', 'ZDTI', 'ZCTI', 'ZCTD', 'ZDTD', 'ZDRC')
and a.sales_org_hdr <> '1002'
and a.sales_org_hdr <> '2002'
and a.agree_class ='ZG' and a.agree_desc not like 'GA-%' and a.end_dat > '20200624'
or a.agree_class ='ZC' and a.agree_desc not like 'CA-%' and a.end_dat > '20200624'
or a.agree_class = 'ZP' and a.agree_desc not like 'PA-%' and a.end_dat > '20200624'
or a.agree_class = 'ZMCA' and a.agree_desc not like 'MCA-%' and a.end_dat > '20200624'
group by a.agree_no, a.um_agree_no, a.agree_class, a.agree_desc, a.end_dat, b.deleted