with x as (
select '20190410' as 日期,'A' as 员工,'XXX' 任务,'' 打分领导,'' 分数 from dual
union all
select '20190410' as 日期,'B' as 员工,'XXX' 任务,'' 打分领导,'' 分数 from dual
union all
select '20190411' as 日期,'A' as 员工,'XXX' 任务,'C' 打分领导,'8.5' 分数 from dual
union all
select '20190411' as 日期,'B' as 员工,'XXX' 任务,'D' 打分领导,'9.8' 分数 from dual
union all
select '20190412' as 日期,'A' as 员工,'XXX' 任务,'' 打分领导,'' 分数 from dual
union all
select '20190412' as 日期,'B' as 员工,'XXX' 任务,'' 打分领导,'' 分数 from dual
union all
select '20190413' as 日期,'A' as 员工,'XXX' 任务,'C' 打分领导,'9.4' 分数 from dual
union all
select '20190413' as 日期,'B' as 员工,'XXX' 任务,'D' 打分领导,'8.8' 分数 from dual
union all
select '20190414' as 日期,'B' as 员工,'XXX' 任务,'C' 打分领导,'7.9' 分数 from dual
union all
select '20190415' as 日期,'B' as 员工,'XXX' 任务,'C' 打分领导,'9.4' 分数 from dual
union all
select '20190416' as 日期,'A' as 员工,'XXX' 任务,'D' 打分领导,'9.5' 分数 from dual
union all
select '20190417' as 日期,'B' as 员工,'XXX' 任务,'C' 打分领导,'9.2' 分数 from dual
)
,x1 as (--员工
select 'A' as 员工 from dual
union all
select 'B' as 员工 from dual
)
,x2 as (--领导
select 'C' as 打分领导 from dual
union all
select 'D' as 打分领导 from dual
)
,d as (--日期维度
SELECT TO_CHAR(TO_DATE('2019-04-10', 'yyyy-MM-dd') + ROWNUM - 1, 'yyyyMMdd') as 日期
FROM DUAL
CONNECT BY ROWNUM <=
trunc(to_date('2019-04-17', 'yyyy-MM-dd') -
to_date('2019-04-10', 'yyyy-MM-dd')) + 1
)
--未打分明细
select a.日期,a.员工,x.打分领导 from (
select * from d,x1,x2
) a left join x on a.日期=x.日期 and a.员工=x.员工 and a.打分领导=x.打分领导
where a.打分领导='C' and x.打分领导 is null
order by a.日期 asc
生成日期,员工,领导维度,去跟打分表匹配,匹配不到的就是没打分的,不过没考虑休息日不上班额情况