读书人

几个表可以用一条sql语句查询出这几

发布时间: 2012-02-06 15:52:45 作者: rapoo

几个表,可以用一条sql语句查询出这几个表中各个表的记录总数吗?
几个表,可以用一条sql语句查询出这几个表中各个表的记录总数吗?

[解决办法]
select sum(a)
from (select count(*)as num from a
union all
select count(*)as num from b
union all
select count(*)as num from c
..........)ta
select (select count(*)as num from a)+(select count(*)as num from b)
[解决办法]
select rowcnt from sysindexes where indid <2 and id=object_id( 'a ') union all
select rowcnt from sysindexes where indid <2 and id=object_id( 'b ') union all
select rowcnt from sysindexes where indid <2 and id=object_id( 'c ')

读书人网 >SQL Server

热点推荐