rrrkrishnan
Programmer
With tbl1 being empty, can someone help me understand why col2 is null.
SELECT MAX(extr_prd_end_dt) AS col1,
COALESCE(MAX(extr_prd_end_dt), CURRENT_DATE-EXTRACT DAY FROM CURRENT_DATE)) AS col2,
COALESCE(MAX(extr_prd_end_dt), CURRENT_DATE) AS col3,
COALESCE(NULL, CURRENT_DATE-EXTRACT(DAY FROM CURRENT_DATE)) AS col4,
CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE) AS col5
FROM tbl1;
col1 col2 col3 col4 col5
? ? 2003-10-06 2003-09-30 2003-09-30
Thanks
Krishnan
SELECT MAX(extr_prd_end_dt) AS col1,
COALESCE(MAX(extr_prd_end_dt), CURRENT_DATE-EXTRACT DAY FROM CURRENT_DATE)) AS col2,
COALESCE(MAX(extr_prd_end_dt), CURRENT_DATE) AS col3,
COALESCE(NULL, CURRENT_DATE-EXTRACT(DAY FROM CURRENT_DATE)) AS col4,
CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE) AS col5
FROM tbl1;
col1 col2 col3 col4 col5
? ? 2003-10-06 2003-09-30 2003-09-30
Thanks
Krishnan