是这样 我要建一个 查询A\B\V\D\E 五张表 所有的数据 建一个view sql语句如何写?
------解决方案--------------------
5张表的结构一样 就用select * from a union all select * from b union ...一直下去
如果不一样,就用null来顶多余的列 还是union all 一直下去
------解决方案--------------------
create view xxx
as
select *
from a
union all
select * from b
union all
.....
------解决方案--------------------
如果用union all
前提是这个五张表,字段数目是一致的,不一致的要手工加列
------解决方案--------------------
create view [视图名]
as
select [字段列表] from A
union all
select [字段列表] from B
union all
select [字段列表] from V
union all
select [字段列表] from D
union all
select [字段列表] from E
PS: 每个子查询的字段列表字段数须一致.