读书人

要统计多张表的总数要如何做

发布时间: 2012-02-11 09:51:35 作者: rapoo

要统计多张表的总数要怎么做
比方说有12张表 tab_1(1月份),tab_2(2月份).........tab_12(12月份).
select count(*) from tab_1 那怎么把12张表的总数都统计出来,写一条语句!!

[解决办法]
select sum(num) from
(select count(*) as num from tab_1
union all
select count(*) as num from tab_2
..
..
select count(*) as num from tab_12
)

读书人网 >oracle

热点推荐