查询到的唯一结果如何行列转化

xyz_hy 2019-12-09 10:19:43

如图为 select fai1,fai2,fai3,fai4,fai5 from cmm_record where id=2 查询到的唯一结果,

如何转化成下面的方式,


FAI(别名) 值
fai1 29.692
fai2 68.739
fai3 66.782
fai4 31.440
...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyz_hy 2019-12-11
  • 打赏
  • 举报
回复
引用 1 楼 csdn_castiel 的回复:
select 'fai1' as 'FAI(别名)',fai1 as '值' from cmm_record where id=2
union all
select 'fai2' as 'FAI(别名)',fai2 as '值' from cmm_record where id=2
union all
select 'fai3' as 'FAI(别名)',fai3 as '值' from cmm_record where id=2
......



谢谢,,恍然大悟啊。。。。。。
csdn_castiel 2019-12-10
  • 打赏
  • 举报
回复
select 'fai1' as 'FAI(别名)',fai1 as '值' from cmm_record where id=2 union all select 'fai2' as 'FAI(别名)',fai2 as '值' from cmm_record where id=2 union all select 'fai3' as 'FAI(别名)',fai3 as '值' from cmm_record where id=2 ......

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧