查询章节的时候也返回课程的类型数据
表结构如下
如果用联表查询如下
select vc.id, vc.title, c.type from video_chapter as vc join course as c where vc.courseid=? group by vc.id
这时候如果把 group by vc.id去掉就会发现端倪。优化成如下。
select vc.id, vc.title, a.type from video_chapter vc ,(select type from course where id=?) a where courseid=?
--END--