Oracle 小问题求解答

来源:百度知道 编辑:UC知道 时间:2024/06/05 01:50:07
select * from studinfo
where studno in
(
select studno from studscoreinfo
where studscore<60
group by studno
order by count(*) desc
)
and rownum<6
提示缺右括号,我该怎么解决
问题在 order by count(*) desc 这句上

都用in了,还要group by,order by干嘛,直接删掉
select *
from studinfo
where studno in
(
select distinct studno
from studscoreinfo
where studscore<60
)
and rownum<6

把子查询中的where换成having试试

子查询中不能使用order by 记住这一点

再说你的句子中也不需要ORDER BY