SQL语句练习
SELECT bb.* from (
SELECT to_char(PERIOD_date,'YYYY-MM-DD') period_code
FROM dw.period_dim
WHERE period_code IN to_char(last_day(PERIOD_DATE),'YYYYMMDD')
AND period_code >= '20210131'
AND period_code <= to_char(SYSDATE,'yyyymmdd')
UNION ALL
SELECT to_char(PERIOD_date,'YYYY-MM-DD') period_code
FROM dw.period_dim
WHERE period_code IN to_char(SYSDATE,'YYYYMMDD')-1) aa
LEFT JOIN Kucun_Kuling_Final bb ON aa.period_code = bb.period_code)
select * from kucun