mercredi 28 novembre 2018

IF ELSE statement in Teradata

I have two sql statements SQL 1 & SQL 2. Further, I want to run them as per below logic,

SELECT * 
FROM MY_TABLE
WHERE COL1 > 0;

If ACTIVITY_COUNT = 0 THEN RUN SQL 1     ----- if records are present then run sql 1

ELSE 

RUN SQL 2    ----- if records are not present the run sql 2

Could you please suggest a SQL code or logic?

Thanks in Advance!

Aucun commentaire:

Enregistrer un commentaire