0

I am trying to find, for shop S9, the friend of the user who posted the most number of reviews for it.

I have the following query:

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 );

I get the following error:

SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"

4

1 回答 1

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 );

如果这不是拼写错误,您将必须进行连接才能到达“.reviews”,因为该语法是不可能的。

于 2013-06-12T16:24:58.923 回答