以下查询应返回从动漫中扮演角色的人物的姓名。但我收到以下错误:
Blockquote ORA-01427:单行子查询返回多个行
SELECT P.NAME, FROM DBS_PERSON P WHERE P.ID = ( SELECT VA.PERSON_ID FROM DBS_VOICEACTOR VA WHERE VA.PERSON_ID = ( SELECT AA.PERSON_ID FROM DBS_ACTSAS AA WHERE AA.CHARACTER_ID = ( SELECT C.ID FROM DBS_CHARACTER C WHERE C.ID = ( SELECT PI.CHARACTER_ID FROM DBS_PLAYSIN PI WHERE PI.SERIE_ID = ( SELECT S.ID FROM DBS_SERIE S WHERE S.ID = '1')))));
提前致谢!
代替
WHERE <field_name> = (SELECT ...
使用
WHERE <field_name> IN (SELECT ...
查询中有5个条件需要更改。
UPD 另外,您的查询等同于
SELECT P.NAME FROM DBS_PERSON P join DBS_ACTSAS AA on P.PERSON_ID = AA.PERSON_ID join DBS_PLAYSIN PI on AA.CHARACTER_ID = PI.CHARACTER_ID join DBS_SERIE S on PI.SERIE_ID = S.ID WHERE S.ID = '1';