当前位置:网站首页>MySQL 实现行转列SQL
MySQL 实现行转列SQL
2022-04-22 05:53:00 【长城Ol】
一个行转列的办法,根据property字段的值a,b转换成不同得列,譬如A,B两列
SELECT date,
sum(CASE property WHEN 'a' THEN value ELSE 0 END) as 'A',
sum(CASE property WHEN 'b' THEN value ELSE 0 END) as 'B'
FROM `table` where date='2020-03-01' GROUP BY date;
版权声明
本文为[长城Ol]所创,转载请带上原文链接,感谢
https://blog.csdn.net/baijunzhijiang_01/article/details/105237964
边栏推荐
- Jasmine X4 tutorial instructions, graphic explanation tutorial
- mysql 外连接 内连接 自连接 ,自然连接,交叉连接
- How can I know in the code whether it runs in JUnit environment?
- Generate go file from proto
- Jasmine x4-q and jasmine x4-1u, detailed comparison
- 数美科技与澎湃新闻联合发布《网络信息内容安全洞察报告》
- Kyushu cloud won the honorary award of "enterprise of 2021"
- 分布式ID
- 不错的简单递归题,字符串递归训练
- Openinfra live | Kyushu yunhuang Shuquan was elected track chair and brought wonderful theme sharing
猜你喜欢
随机推荐
The annual list of its intelligent service excellent enterprises was released, and Kyushu cloud won the "2021 top 10 of Xinchuang operation and maintenance"
MySQL 5.7 重置root密码,试过N中方法终于找到
Analysis and practice of open source at home and abroad
MYSQL 5.7.16解压缩安装过程
supervisord
Redis数据类型使用场景
PostgreSQL中Oid和Relfilenode的映射
TensorFlow 实现web人脸登录系统
为PostgreSQL的表自动添加分区
倒计时一个月,PGConf.Asia2021亚洲大会最新前瞻,有哪些值得关注的亮点?
九州云Edge MEP作为典型产品入选《中国边缘云研究》报告
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/?k=“
Outstanding | Kyushu cloud was selected as an excellent case and industry panorama of the first hybrid cloud conference
Stock common peaking signal
Hit the pain point directly, Kyushu cloud 5g private network helps FAW Fusheng intelligent logistics construction
Jasmine X4 tutorial instructions, graphic explanation tutorial
MYSQL之高性能索引
开源数据库管理系统现在比商业产品更受欢迎
Evaluation of the first Avalon 1246-85t chassis with large computing power and low power consumption
有点意思的质数题HDU5750








