我已经看晕了,各位大佬帮忙看一下
关联之后的表
select * from (
select fymonth, fdate, case substr(c.fmweek,7,1) when '1' then '第一周' when '2' then '第二周' when '3' then '第三周' when '4' then '第四周' when '5' then '第五周' else '第六周' end week from new_report.mdm_time c left join ( select * from(select * from select number2 , state, Subordinate_system, department, last_week_state, task_level , content_task , planned_deliverables , those_responsible , completion_date , actual_completion_date , task_create_day , this_week_state , remaining_days , task_reply_added , tasks_reporting_day1, row_number() over (partition by number2 order by tasks_reporting_day1 desc) rn from NEW_REPORT.TASK_MAINTENANCE) t where t.rn<=1 and t.tasks_reporting_day1 is not null) ) a on a.tasks_reporting_day = c.fdate) e
表1
select * from (select * from( select number2 , state, Subordinate_system, department, last_week_state, task_level , content_task , planned_deliverables , those_responsible , completion_date , actual_completion_date , task_create_day , this_week_state , remaining_days , task_reply_added , tasks_reporting_day1, row_number() over (partition by number2 order by tasks_reporting_day1 desc) rn from NEW_REPORT.TASK_MAINTENANCE) a where a.rn<=1 and a.tasks_reporting_day1 is not null) b
表2
select * from ( select fymonth, fdate, case substr(b.fmweek,7,1) when '1' then '第一周' when '2' then '第二周' when '3' then '第三周' when '4' then '第四周' when '5' then '第五周' else '第六周' end week from new_report.mdm_time ) c
|