日期:2014-05-16 浏览次数:20595 次
SELECT SUM(CASE WHEN t.Status='A' THEN 1 ELSE 0 END) AS CaseA, COUNT(*) AS Total
FROM t
select (select count(1) from tb where 状态码='A')[CodeA],(select count(1) from tb)[total]
from tb
select COUNT(*) Total, CodeA = (select COUNT(*) from dbo.tb where stsus = 'A') from dbo.tb