读书人

怎样对union all结果统计?该怎么解决

发布时间: 2012-03-01 10:25:46 作者: rapoo

怎样对union all结果统计??
(表1) union all (表二)

怎么对得到的结果统计,count() 怎么使用?

[解决办法]
select count(*) from (select .... union all select ...) t
[解决办法]
Select Count(*) From
(
Select * From 表1
Union All
Select * From 表二) A
[解决办法]
select count(*) from (select * from 表1 union all select * from 表2) t

读书人网 >SQL Server

热点推荐