oracle union all 连接三个表后,发现取值不正确
检查发现union all的几个表的字段顺序必须是相同的,不然就会有取数问题.
正确:
select ab.a,ab.b,ab.c from ( (select A.a,A.b,A.c from A)union all(select B.a,B.b,B.c from B) ) ab
错误:
select ab.a,ab.b,ab.c from
(
(select A.a,A.b,A.c from A)union all(select B.b,B.a,B.c from B)
) ab