日期:2014-05-17 浏览次数:21105 次
select UnsubmittedCount = (case when ApproveStatus in ('未提交', '已提交') then count(FormID) end),
ApprovedCount = (case when ApproveStatus in ('已审核') then count(FormID) end)
from formLogistic
group by ApproveStatus
;with c1(UnsubmittedCount,ApprovedCount) AS
(
select null, 4 union all
select 1, null
) --原来查询结果为c1
select
UnsubmittedCount=SUM(UnsubmittedCount),
ApprovedCount=SUM(ApprovedCount)
from c1
SELECT (
SELECT COUNT(FormID) FROM formLogisticgroup WHERE ApproveStatus in ('未提交', '已提交'),
SELECT COUNT(FormID) FROM formLogisticgroup WHERE ApproveStatus in ('已审核'),
)