2015-04-01 36 views
0

我有兩個表。 APP_REVIEWREPLAY,APP_USERREVIEW。我正在使用子查詢從不同的表中由條件,在子查詢返回雙值,所以我得到錯誤。我的錯誤是select詳細詢問條件子查詢得到錯誤

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. 

select * from APP_REVIEWREPLAY where RID=(select RID from APP_USERREVIEW where HALLID=7095) 

回答

2

要麼使用一個連接

select r.* 
from APP_REVIEWREPLAY r 
JOIN APP_USERREVIEW u on u.rid = r.rid 
where u.HALLID=7095 

in條款

select * 
from APP_REVIEWREPLAY 
where RID in (select RID from APP_USERREVIEW where HALLID=7095) 
0

嘗試使用IN子句

select * 
from APP_REVIEWREPLAY 
where RID IN (select RID from APP_USERREVIEW where HALLID=7095)