select Student_ID from Score group by Student_ID having min(score)>=80楼主的意思应该包含80分吧,呵呵
请问 NinGoo(宁哥) having 是什么含义
having相当于where,不过在group by后面不能用where只能用when
写错了,不过在group by后面不能用where只能用having。呵呵
这样写也可以select id from table3 where id not in (select id from table3 where score<80)
上面忘记加distinct了,下午上课没来得及说,现在补上,呵呵 select distinct id from table3 where id not in (select id from table3 where score<80) 至于效能,第一个语句只需要一次扫描,第二局需要2次扫描,我认为还是第一句好一点,呵呵
select Student_ID from Score group by Student_ID having min(score)>=80好象不行吧?斑竹试了这条语句没有?
having 是什么含义
(select id from table3 where score<80)
select distinct id from table3 where id not in
(select id from table3 where score<80)
至于效能,第一个语句只需要一次扫描,第二局需要2次扫描,我认为还是第一句好一点,呵呵
楼主试了没?
谢谢大家,尤其感谢NinGoo(宁哥)