--有两闭前散个方法
--楼下的是一种 tmp是表的别名
--两外一种就是 把条件合在一起就轿氏可以了 前提是二者没有交叉
select count(1) from KJ_XMJB
where ((fXMCGXS>0 and fXMCGXS<5) or fXMCGXS=8) or
(fXMJSJJMB>0 AND fXMJSJJMB<3)
--不明白可以随时问我 希望悔游采纳
将两个值竖罩分别付给两个变量。乱纤蠢将第一个count(*)改为count(1),第二个改为count(2),
count(1)哗陪+count(2)即可
试并悄试这样:闷蔽誉
select sum(a) from
(
SELECT count(*) a from KJ_XMJB where (fXMCGXS>0 and fXMCGXS<蚂段5) or fXMCGXS=8
union all
SELECT count(*) a from KJ_XMJB where fXMJSJJMB>0 AND fXMJSJJMB<3
) tmp
select count(*) from (
SELECT * from KJ_XMJB where (fXMCGXS>0 and fXMCGXS<5) or fXMCGXS=8
union all
SELECT * from KJ_XMJB where fXMJSJJMB>缺咐芹伏毕简败0 AND fXMJSJJMB<3)
SELECT count(*)from KJ_XMJB where (fXMCGXS>皮姿侍0 and fXMCGXS<册棚5) or fXMCGXS=8
or fXMJSJJMB>燃吵0 AND fXMJSJJMB<3