UNION ALL query: “Too Many Fields Defined”

后端 未结 3 898
南方客
南方客 2021-01-12 22:57

I\'m trying to get a UNION of 3 tables, each of which have 97 fields. I\'ve tried the following:

select * from table1
union all
select * from table2
union a         


        
3条回答
  •  -上瘾入骨i
    2021-01-12 23:31

    Perhaps if your 3 tables have duplicate records you can go with UNION instead of UNION ALL which may reduce the number of fields to be tracked. Because UNION will always serve the business purpose which removes duplicates. In that case your query will be like following,

    select * from table1
    union
    select * from table2
    union
    select * from table3;
    

提交回复
热议问题