Reputation: 3037
I'm trying to test if a DB2 table has been updated today.
I can get the latest update date:
SELECT DATE(REFRESH_TIME) as rfrsh_day
FROM SYSIBM.SYSTABLES
WHERE NAME in ('my_table');
and today's date:
SELECT current date as today FROM SYSIBM.SYSDUMMY1;
I want a TRUE if rfrsh_day == today
, otherwise FALSE. How would I compare these in a single SQL statement?
Upvotes: 0
Views: 108
Reputation: 1269873
Use a case
statement:
SELECT (case when DATE(REFRESH_TIME) = CURRENT DATE then 'true' else 'false' end) as rfrsh_day
FROM SYSIBM.SYSTABLES
WHERE NAME in ('my_table');
Upvotes: 1