-2

我正在尝试运行如下查询,但它会引发“单行子查询返回多行”错误。它可以使用 = 代替 <> (返回超过 50 行作为最终输出)。当我使用 <> 时无法弄清楚出了什么问题。试过 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'
4

1 回答 1

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'
于 2015-07-14T13:00:24.737 回答