--参考:
select 项目,合同收入 as 指标数值,'1' as 类型id from 表名
union all
select 项目,实付 as 指标数值,'2' as 类型id from 表名
union all
select 项目,实际收入 as 指标数值,'3' as 类型id from 表名
union all
select 项目,预付支出 as 指标数值,'4' as 类型id from 表名
影丶 回复 18328816101(提问者)一种方式是直接将原本的查询结果当成伪表进行嵌套查询,另一种方式就是替换对应位置的字段计算方式,然后union all连接起来,如:select 项目,sum(asd) as 指标数值,\'1\' as 类型id from 表名
union all select 项目,sum(qwe) as 指标数值,\'2\' as 类型id from 表名