日期:2014-05-18 浏览次数:20616 次
select count(*) from ( select * from hs2005.KeepedVoucher union all select * from hs2006.KeepedVoucher union all select * from hs2007.KeepedVoucher union all select * from hs2008.KeepedVoucher union all select * from hs2009.KeepedVoucher union all select * from kjhssj.KeepedVoucher ) t
select count(*) from ( select * from hs2005..KeepedVoucher union all select * from hs2006..KeepedVoucher union all select * from hs2007..KeepedVoucher union all select * from hs2008..KeepedVoucher union all select * from hs2009..KeepedVoucher union all select * from kjhssj..KeepedVoucher ) t
------解决方案--------------------
select sum(ct) from ( select count(0) ct from hs2005.KeepedVoucher union all select count(0) ct from hs2006.KeepedVoucher union all select count(0) ct from hs2007.KeepedVoucher union all select count(0) ct from hs2008.KeepedVoucher union all select count(0) ct from hs2009.KeepedVoucher union all select count(0) ct from kjhssj.KeepedVoucher ) t
------解决方案--------------------
select (select count(*) from hs2005.KeepedVoucher )+ (select count(*) from hs2006.KeepedVoucher )+ (select count(*) from hs2007.KeepedVoucher )+ (select count(*) from hs2008.KeepedVoucher )+ (select count(*) from hs2009.KeepedVoucher )+ (select count(*) from kjhssj.KeepedVoucher )
------解决方案--------------------
你可以这样做啊,先把这些表的数据的条数列出来,然后在对这些表的数据进行求和就好啦。
select sum(t.c)
from
(
select count(*) c from dbo.xt_tbno
union all
select count(*) c from dbo.xt_user_resource
union all
select count(*) c from dbo.xt_role_resource
union all
select count(*) c from dbo.xt_subsystem
) t