当前位置:网站首页>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
边栏推荐
- How to delete a statement audit log?
- Embedded development: tools -- intelligent watchdog design
- Drools(4):Drools基础语法(2)
- 10 papers of ant security laboratory were included by ccf-a top meeting to explore the realization of AI credibility from the perspective of algorithm
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions
- 从XSS Playload 学习浏览器解码
- HCIP --- MPLS技术
- Performance test -- lockust performs seckill business scenario test
- Check the top 10 best graphics software of the year, meet 99% of your chart needs, and collect it quickly
- [database] CTE (common table expression)
猜你喜欢

redis-migrate-tool迁移报错。

Analysis of strong tennis cup 2021 PWN competition -- baby_ diary

Opencv learn resize and crop

Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions

Kernel pwn 入门 (5)

Drools(3):Drools基础语法(1)

Airiot IOT platform enables the container industry to build a welding station information monitoring system

Queue assistant | product update log in June 2022
![[database] CTE (common table expression)](/img/36/812026995f5d0b64d26f1667638010.png)
[database] CTE (common table expression)

WPS or office compression of ppt
随机推荐
Kernel pwn 入门 (5)
Can you learn fast and well with dual stream network? Harbin Institute of Technology & Microsoft proposed a distillation dual encoder model for visual language understanding, which can achieve fast an
Contents mismatch at: 08000000H (Flash=FFH Required=00H) ! Too many errors to display !
Common CMD instructions
正则表达式如何写变量
shape 和 size() 区别
Difference between shape and size ()
Opengauss simple version installation error
Advanced Mathematics (Seventh Edition) Tongji University General exercises two person solution
To do list application vikunja
Linux c SQLite database usage
Flame diagram analysis Flink backpressure
What to pay attention to when using German chicks for the first time
Differences in the use of function call pointer parameters *p, * & P
从XSS Playload 学习浏览器解码
Hands on practice - teach you how to make an intelligent fish tank with STM32
Weekly tip 142: multi parameter constructors and explicit
AcWing-每日一题
微信小程序 - 从入门到入土
屏:框贴、0贴合、全贴合