sql="select COUNT(*) as wzzs from TOPIC where ROOMID not in(0,5) and DELid=0"
rs.open sql,conn,3,3
wzzs=rs("wzzs")rs.close
sql="select COUNT(*) as ttzs from TOPIC where ROOMID in(5) and DELid=0"
rs.open sql,conn,3,3
ttzs=rs("ttzs")rs.close
sql="select COUNT(*) as xszs from TOPIC where ROOMID in(0) and DELid=0"
rs.open sql,conn,3,3
xszs=rs("xszs")
rs.open sql,conn,3,3
wzzs=rs("wzzs")rs.close
sql="select COUNT(*) as ttzs from TOPIC where ROOMID in(5) and DELid=0"
rs.open sql,conn,3,3
ttzs=rs("ttzs")rs.close
sql="select COUNT(*) as xszs from TOPIC where ROOMID in(0) and DELid=0"
rs.open sql,conn,3,3
xszs=rs("xszs")
+"(select COUNT(*) as wzzs from TOPIC where ROOMID not in(0,5) and DELid=0)as ttzs,"
+"(select COUNT(*) as wzzs from TOPIC where ROOMID not in(0,5) and DELid=0)as xszs"
1:如果数据库是sql serverselect sum(case when ROOMID not in(0,5) then 1 else 0) as wzzs
,sum(case when ROOMID in(5) then 1 else 0) as ttzs
,sum(case when ROOMID in(0) then 1 else 0) as xszs
from TOPIC
where DELid=02:如果是access数据, 就用iif函数
,sum(iif((ROOMID in(5)),1,0) ) as ttzs
,sum(iif((ROOMID in(0)),1,0) ) as xszs
from TOPIC
where DELid=0
select COUNT(*) as wzzs,
(select COUNT(*) from TOPIC where ROOMID in(5) and DELid=0) as ttzs,
(select COUNT(*) from TOPIC where ROOMID in(0) and DELid=0) as xszs
from TOPIC where ROOMID not in(0,5) and DELid=0速度可能会慢点,但是肯定是可以的