2020-04-13
阅读量:
420
这里为什么不用分组?
问:
-- 7、查询学过"张三"老师授课的同学的信息
select *
from stu
where s_id in(select s_id from sc left join co on sc.c_id=co.c_id left join te on co.t_id=te.t_id where t_name='张三');
还有另一种方法,
(select max(score)
from stu
left join sc on stu.s_id=sc.s_id
left join co on sc.c_id=co.c_id
left join te on te.t_id=co.t_id
where t_name='张三');
这里为什么不用分组?
答:
这两个要求的都不一样,这道题没有要求分组,是不用分组的,如果是想去除重复值,在selsect后加distinct就行了






评论(0)


暂无数据