当前位置:网站首页>How to convert multi row data into multi column data in MySQL
How to convert multi row data into multi column data in MySQL
2022-07-26 07:14:00 【CSDN Q & A】
There is a table with the following two fields
| question_id | content |
|---|---|
| 1111 | Test content 1 |
| 1111 | Test content 2 |
| 1111 | Test content 3 |
| 2222 | Hello , The world |
| 2222 | The sun rises |
I want to achieve the following business :
according to question_id, Find all content, And will content Turn to multiple columns in a row , For example, I'm looking for question_id = 1111 Of , The final result is as follows :
| question_id | content1 | content2 | content3 |
|---|---|---|---|
| 1111 | Test content 1 | Test content 2 | Test content 3 |
Be careful :question_id It needs to be passed in according to the query criteria , And content The content is uncertain , And according to question_id The content found is not necessarily 2 That's ok , There may be multiple lines , In other words, it cannot be based on case when This kind of writing judgment content
How should I realize
My solution ideas and tried methods
What I want to achieve
边栏推荐
- Leetcode:749. isolate virus [Unicom component + priority queue + status representation]
- Check the top 10 best graphics software of the year, meet 99% of your chart needs, and collect it quickly
- Deep learning visualization
- RGB-T追踪——【数据集基准】GTOT / RGBT210 / RGBT234 / VOT-2019-2020 / LasHeR / VTUAV
- NiO implementation
- Heap parsing and heap sorting
- Screen: frame paste, 0 fit, full fit
- 20220725 自动控制原理中的补偿器
- [yiku] wonderful! This library organization NPM script is simply explosive!
- LTS(Light-Task-Scheduler)
猜你喜欢

Drools (3): drools basic syntax (1)

"Wei Lai Cup" 2022 Niuke summer multi school training camp 1 supplementary question record (acdgij)
![[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal](/img/7d/7a01c8c6923077d6c201bf1ae02c8c.png)
[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal

Qt:列表框、表格、树形控件

No .egg-info directory found in xxx\pip-pip-egg-info-mq

20220725 自动控制原理中的补偿器

Opencv learning drawing shapes and text

解决 Chrome 浏览器被毒霸篡改问题

Precious metal knowledge: lethal short-term secret script

Contents mismatch at: 08000000H (Flash=FFH Required=00H) ! Too many errors to display !
随机推荐
404 page best practices to improve user experience
centos7下的MySQL57版本,遇到一个问题不理解有知道的大shen告知
又是一年开源之夏,1.2万项目奖金等你来拿!
Is it safe to invest in treasury bonds in 2022? How do individuals buy treasury bonds?
Acwing- daily question
Leetcode:749. isolate virus [Unicom component + priority queue + status representation]
Leetcode 1184:公交站间的距离
为什么extern使用const修饰的变量会编译不过?
LTS(Light-Task-Scheduler)
[database] CTE (common table expression)
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions
中国联通改造 Apache DolphinScheduler 资源中心,实现计费环境跨集群调用与数据脚本一站式访问
Shared lock
MySQL self incrementing lock
How to delete a statement audit log?
Opencv learning warp Perspective
C51与MDK共存 Keil5安装教程
屏:框贴、0贴合、全贴合
正则表达式如何写变量
MySQL execution plan