表之間的數據匹配(Oracle)

來源表1:sql

來源表2:3d

生成一個交叉表:blog

sql:test

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;select

相關文章
相關標籤/搜索