不同表的不同字段值在视图中合并到一个字段中

A表:            b表:                  c表
a1 b1 c1       a1  b1  d1       a1   b1  e1
1  2  3             1    2  4        1   2   5  

结果:(视图D)
   F1         F2           F3
   1           2             3
   1           2             4
   1           2             5



实现合并的语句:
Create View D
As
Select a1 As F1, a2 As F2, a3 As F3 From A
Union All
Select * From B
Union All
Select * From C
GO

猜你喜欢

转载自liuzhiqiang19890403.iteye.com/blog/2017426