请问如何创建一个View包含两个不同结构的表的数据?
表A
FID FBeginTime FEndTime FPrice FChecker
1 2006-12-13 2006-12-15 200.00 张三
表B
FID FEndTime FTtlPrice FOperationer
1 2006-11-10 80.00 王五
创建View包含
FRecod(自增长) FEndTime FPrice FChecker
1 2006-12-13 200.00 张三
2 2006-11-10 80.00 王五
该视图怎么写?谢谢
[解决办法]
Create View V_TEST
As
Select
FBeginTime As FEndTime,
FPrice,
FChecker
From
A
Union
Select
FEndTime,
FTtlPrice,
FOperationer
From
B
GO
[解决办法]
select
(
select count(1) from
(
select FEndTime ,FPrice ,FChecker
from 表A
union all
select FEndTime, FTtlPrice,FOperationer
) tt where t.FEndTime> =tt.FEndTime
) as FRecod ,FEndTime,FPrice,FChecker
from
(
select FEndTime ,FPrice ,FChecker
from 表A
union all
select FEndTime, FTtlPrice,FOperationer
) t