我写了以下脚本
SELECT vil.account_id ,
vil.imp_id,
vil.owner ,
vil.start_date,
CASE
WHEN ac.status = 4
THEN status_date
ELSE NULL
END AS Live_date,
cs.country_code
FROM ACCOUNT ac
INNER JOIN vu_imp_list vil
ON vil.account_id = ac.account_id
INNER JOIN entity e
ON ac.entity_id = e.entity_id
INNER JOIN country_specifics cs
ON e.country_id = cs.country_id
WHERE (vil.account_id, vil.start_date) =
(SELECT vils.account_id, MIN(vils.start_date)
FROM vu_imp_list vils
WHERE vil.account_id IN ('825808009','987323136')
group by vils.account_id);
但我一直收到错误
SQL Error: ORA-01427: single-row subquery returns more than one row
01427. 00000 - "single-row subquery returns more than one row"
我试图为子查询添加rownum = 1
子句where
,但似乎查询永远运行。我已经单独测试了子查询,它为每个返回一行account_id
。这里的大多数类似问题都与insert
问题有关,update
而不仅仅是查询。