select Editor, sum(case passed when 1 then 1 else 0 edn) PassCount,
sum(1) TotalCount
from article where month(getdate())=month(UpdateTime)
group by editor order by Editor
sum(1) TotalCount
from article where month(getdate())=month(UpdateTime)
group by editor order by Editor
count(*) TotalCount
from article where month(getdate())=month(UpdateTime)
group by editor
order by Editor
,被录用的稿件数=sum(case passed when 1 then 1 else 0 end)
,投稿总数=count(*)
from 表
group by Editor
count(*) TotalCount
from article where month(getdate())=month(UpdateTime)
group by editor
order by Editor
你的passed列应该是用0,1表示的吧
在ACCESS中应如何去写呢?
解决就结贴
,被录用的稿件数=sum(iif(passed=1,1,0))
,投稿总数=count(*)
from 表
group by Editor
,sum(iif(passed=1,1,0)) as 被录用的稿件数
,count(*) as 投稿总数
from 表
group by Editor
sum(1)或是SUM(0),
SUM 函数是求字段值的和的,
我还是不太清楚,用在SQL中,sum(case passed when 1 then 1 else 0 edn)
或sum(iif(passed=1,1,0)) as
怎么就能求,PASSED 为真的记录个数了呢?
,sum(iif(passed,1,0)) as 被录用的稿件数
,count(*) as 投稿总数
from 表
group by Editor
站前消防大队
站前消防大队
站前消防大队
站前消防大队
站前消防大队Passed //字段名
Yes
No
No
No
No
No
UpdateTime //字段名
2003-12-30 12:01:45
2003-12-30 11:31:45
2003-12-30 11:31:25
2003-12-30 11:30:17
投稿总数 11 记录个数可能跟上面的不贴出来的有所不同,实际的记录要多
,sum(iif(passed,1,0)) as 被录用的稿件数
,count(*) as 投稿总数
from 表
group by Editor
select Editor,sum(case when passed=1 then 1 else 0 end) as 录用稿数,sum(1) as 总投稿数
from 表
group by editor
投稿总数 11 记录个数可能跟上面的不贴出来的有所不同,实际的记录要多
-----------------------------------------------------------------
true 的数值表示是 -1,false 是 0
所以才会出现负数
select Editor,sum(case passed when 'yes' then 1 else 0 end) as 录用稿数,sum(1) as 总投稿数
from 表
group by editor
sum(iif(passed=true,true,false)) as 被录用的稿件数
--我不是写了几次吗,应该是这样才对啊:
sum(iif(passed=true,1,0)) as 被录用的稿件数
,sum(iif(passed='YES',1,0)) as 被录用的稿件数
,count(*) as 投稿总数
from 表
group by Editor
1 站前消防大队 11 11
2 西市消防大队 1 1
马上结贴现在在CSDN中也只有在这个板块中还有能人存在