你能帮助我知道我的sql中的错误是什么吗?ORA-00936:我有缺失的表达式错误,但我找不到错误。
select p.nompr
from produit p
where p.idpr=(select o.idpr
from objet o,enchere e
where o.idobj=e.idobj
group by o.idpr
having(count(*)=select Max(count (o1.idpr))
from objet o1,enchere e1
where o1.idobj=e1.idobj
group by o1.idpr) );发布于 2015-10-09 09:14:17
我已经重建了你的查询。我相信您在这里要实现的是获得出现次数/计数最多的p.nompr:
select p.nompr
from produit p
where p.idpr in(
select idpr_alias from (SELECT count (o1.idpr) CNT, o1.idpr idpr_alias
from objet o1,enchere e1
where o1.idobj=e1.idobj
group by o1.idpr)
where CNT=(select max(count(o1.idpr)) from objet o1,enchere e1
where o1.idobj=e1.idobj
group by o1.idpr))发布于 2015-10-09 09:04:00
这段代码是否有片断:
select Max(count (o1.idpr))
from objet o1,enchere e1
where o1.idobj=e1.idobj
group by o1.idpr它自己运行吗?我怀疑你不能像那样一起使用max()和count()。
https://stackoverflow.com/questions/33028151
复制相似问题