A\B\C三个表,A表和B表中只有一个表可以查询到registno
select registno, status from A where registno = '123456';
select registno, status from B where registno = '123456';
select pumpid from C;
我如下这么写就报错
select a.registno, b.pumpid
from
(select registno, status from A where registno = '123456'
union
select registno, status from B where registno = '123456') a
,outer prplcompensate b
where
a.registno=b.registno
group by 1;
错误信息:
[Code: -999, SQL State: IX000] Not implemented yet. [Script position: 2976 - 2957]
是我语句有问题吗?
outer去掉,或者改成left outer join
group by 1从查询结果看好像没啥作用
select a.registno, b.pumpid
from
(select registno, status from A where registno = '123456'
union
select registno, status from B where registno = '123456') a
, prplcompensate b
where
a.registno=b.registno
group by 1;
select a.registno, b.pumpid
from
(select registno, status from A where registno = '123456'
union
select registno, status from B where registno = '123456') a
left outer join prplcompensate b on a.registno=b.registno
group by 1;
好像b.pumpid这个值没有用吧
select a.registno from (select registno from A where registno = '123456' union select registno from B where registno = '123456')a left join prplcompensate b on a.registno=b.registno;
前面展示的列必须都在group by后面,不然用聚合函数。是不是这个原因?