以下查询应返回动画角色扮演角色的人的姓名。但是我收到以下错误:
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')))));
提前致谢!
答案 0 :(得分: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';