表之间的数据匹配(Oracle)
来源表1:
来源表2:
生成一个交叉表:
sql:
select t.course_name,
max(case when t.month=\’200706\’ then \’o\’ else \’*\’ end) “6月”,
max(case when t.month=\’200707\’ then \’o\’ else \’*\’ end) “7月”,
max(case when t.month=\’200708\’ then \’o\’ else \’*\’ end) “8月”
from
(select month,course_name from dim_ia_test20 a,dim_ia_test21 b where a.course_id=b.course_id)t
group by course_name;