I have (2) case statements:
SELECT CASE WHEN EXISTS
( SELECT *
FROM MYTABLE_A
WHERE timestamp = to_char(sysdate-1, 'yyyymmdd') || '0000'
)
THEN 0
ELSE 1
END AS FLAG_MYTABLE_A
from DUAL;
SELECT CASE WHEN EXISTS
( SELECT *, timestamp
FROM MYTABLE_B
WHERE
timestamp = to_char(sysdate-1, 'yyyymmdd') || '0000'
) )
THEN 0
ELSE 1
END AS FLAG_MYTABLE_B
from DUAL;
RESULTS:
FLAG_MYTABLE_A
--------------
0
FLAG_MYTABLE_B
--------------
1
I need help constructing this query so I can get the following results displayed.
MYTABLENAME MYFLAG
----------- ------
MYTABLE_A 0
MYTABLE_B 1
Am I looking at a nested select? Can someone show me how to set this up?
You can use
UNION ALL: