日期:2014-05-18  浏览次数:20484 次

一个集总查询
select count(*.Microsoft资料) + count(*.RAZER资料)+count(*.罗技资料) 产品总数
from Microsoft资料,RAZER资料,罗技资料

不知道是不是全域名错误。它提示是.附近错误

------解决方案--------------------
Try
SQL code

---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 总数