select '当前任务总数:'+count(*) +',其中'+sum(case when 任务状态='未处理' then 1 else 0 end) +'未处理,' + sum(case when 任务状态='处理中' then 1 else 0 end) +'处理中'
from 表名
select count(1), 任务状态 from table grounp by 任务状态,这样不就出现一个结果集,两条记录 1: 15 未处理;2:1 正处理。至于输出么,你自己组装好了!
select '当前任务总数:'||count(*)||',其中'||sum(case when 任务状态='未处理' then 1 else 0 end)||'个未处理,'||sum(case when 任务状态='处理中' then 1 else 0 end)||'个正在处理中'
from table1