首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

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

几个表,可以用一条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 ')

热点排行