1,当前表
course_master open_course
2/实现效果
SELECT
[curse_name]
,case when [course_id] in (select course_id from [PHONE_MANAGE].[dbo].OPEN_COURSE where month = '200706') then 'O' ELSE 'X' END 六月
,case when [course_id] in (select course_id from [PHONE_MANAGE].[dbo].OPEN_COURSE where month = '200707') then 'O' ELSE 'X' END 七月
,case when [course_id] in (select course_id from [PHONE_MANAGE].[dbo].OPEN_COURSE where month = '200708') then 'O' ELSE 'X' END 八月
FROM [PHONE_MANAGE].[dbo].[COURSE_MASTER]