使用嵌套子查询时,Oracle单行子查询返回多行

时间:2015-07-14 12:33:18

标签: oracle ora-01427

我正在尝试运行如下所示的查询,但它会抛出“单行子查询返回多行”错误。它适用于=代替<>虽然(返回超过50行作为最终输出)。当我使用<> .Tried NOT IN时,无法弄清楚什么是错误的,不起作用。请帮忙。

select a,
       b,
       c,
       d,
       e 
from 
   (select distinct column1 as a,
                    column2 as b,
                    column3 as c,
                    column4 as d,
                    column5 as e
     from t1
     where t1.column1 like 'DOMAIN.%')
where c||d||e <> 'YYY'

1 个答案:

答案 0 :(得分:0)

这只是一种预感,但我认为您在查询中缺少内联视图别名,如下所示

from 
   (select distinct column1 as a,
                    column2 as b,
                    column3 as c,
                    column4 as d,
                    column5 as e
     from t1
     where t1.column1 like 'DOMAIN.%') XXX <-- this one

此外,请尝试使用CONCAT()功能,而不是

where concat(concat(c,d),e) <> 'YYY'