oracle中视图使用union连接建立两个视图后,再使用union将两个视图连接成一个视图,为什么select出来的数据比两个视图的总个数少,注(使用union all)
我连接的时候就是使用的union all,而且查询的两次的结果条数还不同
追答你看你视图是怎么建的,是不是视图里的表的数据发生变化了
本回答被提问者采纳第一个视图:create or replace view leave_out as select a.info,a.id,a.user_id,a.begin_time start_time,a.end_time end_timr, '1'typed
from B_ATT_FLOW_LEAVE a where a.Bmjlqz = '审批通过'
union all 连接另一个表
第二个视图跟第一个差不多的,之后的合并查询的:
select * from holiday_meet
union all
select * from leave_out_btravel
应该不会有问题啊,你select count() from 视图1 ,和select count(*) from 视图2 的和
跟
select count(*) from
(select * from 视图1
union all
select * from 视图2)不一样吗?