日期:2014-05-18 浏览次数:20642 次
---1、
Declare @M int,@R int,@RJ int
Select @M=Count(1) From Microsoft资料
Select @R=Count(1) From RAZER资料
Select @RJ=Count(1) From 罗技资料
Select @M+@R+@RJ As 产品总数
---2、
Select Count(1) As 产品总数
From (
Select Microsoft资料表字段1 From Microsoft资料
Union All
Select RAZER资料字段1 From RAZER资料
Union All
Select 罗技资料字段1 From 罗技资料 ) As T
------解决方案--------------------
不应该用连接
应该每个表分别统计后再相加
select (select count(*) from Microsoft资料)+(select count(*) from RAZER资料)+(select count(*) from 罗技资料) as 总数