我想为商店S9找到为其发布最多评论的用户的朋友。
我有以下查询:
select friend_id
from friends
where user_id = ( select author_id
from posted_reviews_tab
where rownum <= 1
and reviewid in ( select w.reviews.reviewid
from wall_tab w
where w.shopid = 'S9' )
group by author_id
order by count(author_id) desc );
我收到以下错误:
SQL错误:ORA-00907:缺少右括号 00907. 00000 - “缺少右括号”
答案 0 :(得分:2)
选择中有一个拼写错误:
select friend_id
from friends
where user_id = ( select author_id
from posted_reviews_tab
where rownum <= 1
--w.reviews.reviewid is wrong
and reviewid in ( select w.reviews.reviewid
from wall_tab w
where w.shopid = 'S9' )
group by author_id
order by count(author_id) desc );
如果这不是拼写错误,您必须制作join才能到达&#39; .reviews&#39;因为那种语法是不可能的。