Home Article Practice SQL语句练习

SQL语句练习

2022-08-30 11:25  views:653  source:小杨一定要减肥    

WITH kucun AS (
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



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)