2014-10-22 58 views
0
select distinct a.person.name, b.title,b.director.name 
    from movie_roles a, movie b 
where a.person.name= 
(select b.director.name 
    from movie b, movie_roles a 
    where b.director.name=a.person.name) 
    and b.movieID=a.movie.movieID; 

我一直收到錯誤消息,指出單個子查詢在Oracle中返回多行。
任何人都可以幫我解決這個問題嗎?單個子查詢返回Oracle中的多行

+2

加入時間瞭解我認爲 – Strawberry 2014-10-22 11:57:51

回答

2

這是自explanatory.In以下行

where a.person.name= (select b.director.name from movie b, movie_roles a where b.director.name=a.person.name) 

,所以你不能用「=」你不止一個結果。嘗試

where a.person.name IN(select b.director.name from movie b, movie_roles a where b.director.name=a.person.name) 
+0

謝謝! 剛剛實現的「=」將返回多行 – 2014-10-27 00:03:13

+0

實際上,您的子查詢返回多個結果,這就是您不能使用'='運算符的原因。 – geoandri 2014-10-27 06:51:55