string SJ = DateTime.Now.Year.ToString();
string str =string.Format(@"select first 1
(select count(*) from OfficialCaseRegisters where FillTime='{0}') as a,
(select case (select count(*) from OfficialCaseRegisters where FillTime='{1}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where FillTime='{2}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{3}') as b,
(select count(*) from OfficialCaseRegisters where PostName='正处' and FillTime='{4}') as c,
(select case (select count(*) from OfficialCaseRegisters where PostName='正处' and FillTime='{5}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='正处' and FillTime='{6}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{7}') as d,
(select count(*) from OfficialCaseRegisters where PostName='副处' and FillTime='{8}') as e,
(select case (select count(*) from OfficialCaseRegisters where PostName='副处' and FillTime='{9}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='副处' and FillTime='{10}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{11}') as f,
(select count(*) from OfficialCaseRegisters where PostName='正科' and FillTime='{12}') as g,
(select case (select count(*) from OfficialCaseRegisters where PostName='正科' and FillTime='{13}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='正科' and FillTime='{14}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{15}') as h,
(select count(*) from OfficialCaseRegisters where PostName='副科' and FillTime='{16}') as j,
(select case (select count(*) from OfficialCaseRegisters where PostName='副科' and FillTime='{17}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='副科' and FillTime='{18}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{19}') as k,
(select count(*) from OfficialCaseRegisters where PostName='科办员' and FillTime='{20}') as l,
(select case (select count(*) from OfficialCaseRegisters where PostName='科办员' and FillTime='{21}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='科办员' and FillTime='{22}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{23}') as z,
(select count(*) from OfficialCaseRegisters where PostName='试用期人员' and FillTime='{24}') as x,
(select case (select count(*) from OfficialCaseRegisters where PostName='试用期人员' and FillTime='{25}')
when 0 then 0 else((select count(*) from OfficialCaseRegisters where PostName='试用期人员' and FillTime='{26}')*100.0 / count(*))
end from OfficialCaseRegisters where FillTime='{27}') as v
from OfficialCaseRegisters ", SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ, SJ);
参数sj表示查询条件。