SELECT CDAN8 BillTo,CDWMNC CreditCardName, CDWSV CreditCardNumber,CDMNTH CreditCardMonth, CDBLYR CreditCardYear,
(Case WHEN CDADD1 IS NULL OR CDADD1 = '' THEN ALADD1 ELSE CDADD1 END) CreditCardAddressLine1,(Case WHEN CDMSCY IS NULL OR CDMSCY =
'' THEN ALCTY1 ELSE CDMSCY END) CreditCardCity, (Case WHEN CDUSEX IS NULL OR CDUSEX = '' THEN ALADDS ELSE CDUSEX END)
CreditCardState,
(Case WHEN CDZIP IS NULL OR CDZIP = '' THEN ALADDZ ELSE CDZIP END) CreditCardZip,(Case WHEN CDDC IS NULL OR CDDC = '' THEN ALCTR
ELSE CDDC END) CreditCardCountry,
CDYN03 IsActive from table1 A LEFT JOIN table2 B ON A.CDAN8 = B.ALAN8
where cdan8='107189' and ((CDBLYR = 2015 and CDMNTH > 8) or CDBLYR >= 2016)
order by cdan8 desc
(Case WHEN CDADD1 IS NULL OR CDADD1 = '' THEN ALADD1 ELSE CDADD1 END) CreditCardAddressLine1,(Case WHEN CDMSCY IS NULL OR CDMSCY =
'' THEN ALCTY1 ELSE CDMSCY END) CreditCardCity, (Case WHEN CDUSEX IS NULL OR CDUSEX = '' THEN ALADDS ELSE CDUSEX END)
CreditCardState,
(Case WHEN CDZIP IS NULL OR CDZIP = '' THEN ALADDZ ELSE CDZIP END) CreditCardZip,(Case WHEN CDDC IS NULL OR CDDC = '' THEN ALCTR
ELSE CDDC END) CreditCardCountry,
CDYN03 IsActive from table1 A LEFT JOIN table2 B ON A.CDAN8 = B.ALAN8
where cdan8='107189' and ((CDBLYR = 2015 and CDMNTH > 8) or CDBLYR >= 2016)
order by cdan8 desc
No comments:
Post a Comment