我有如下三个表:
测试
+--------------+--------+
| Test_Case_ID | Status |
+--------------+--------+
| 10 | PASS |
| 20 | FAIL |
| 30 | FAIL |
+--------------+--------+
缺点
+-----------+
| Defect_ID |
+-----------+
| 500 |
| 400 |
+-----------+
和链接1
+--------------+-----------+
| Test_Case_ID | Defect_ID |
+--------------+-----------+
| 20 | 500 |
| 30 | 500 |
| 30 | 400 |
+--------------+-----------+
我正在尝试以下查询
select
test.test_case_id,
test.status,
case when test.status = 'FAIL' then
(select link1.defect_id
from link1
where
test.test_case_id = link1.test_case_id)
end as defect1_id
from test test
我收到以下错误“错误 12/20/2012 10:05:17 AM 0:00:00.093 Toad for Data Analysts: ORA-01427: single-row subquery returns more than one row 1 78”
有没有办法从链接表中检索“30”的记录?因为我想显示测试用例 30 由于缺陷 500 和 400 而失败。
非常感谢