用union all试试
select
name,
case when value = '1' then '1' else '1' end as '1'
from
tablename
where
name = '张三'
union all
type,
case when value = '2' then '2' else '2' end as '2'
sqlserver试一下 https://www.cnblogs.com/kylan/p/10844414.html
unpivot pivot试下
https://bbs.fanruan.com/wenda/question/63965.html
参考这个
MySQL---group_concat