当前位置:网站首页>MySQL converts comma separated attribute field data from column to row
MySQL converts comma separated attribute field data from column to row
2022-07-03 16:29:00 【Xiao Chen - Programmer】
Mysql Convert comma separated attribute fields to row data
Mysql Convert comma separated attribute fields to row data .
- scene :
At development time , We will design the database table according to the requirements . Sometimes when designing data tables, we can't conform to the three paradigms , Complexity of cause scenario , If we follow the three paradigms all the time , It will increase our development . Sometimes we use commas to store some in an attribute value id It's worth waiting for . When querying, you need to convert attributes into rows .
- data :

- solve :
select a.*,SUBSTRING_INDEX(SUBSTRING_INDEX(a.content,',',b.id),',',-1) content
from temp a
join temp b
where b.id <= LENGTH(a.content)-LENGTH(REPLACE(a.content,',',''))+1
- result :

- Function analysis
SUBSTRING_INDEX : Get separator after separation , Get the string according to the last parameter index , Negative numbers are reciprocal
LENGTH : character string length
REPLACE : Replace string
summary :
join The table needs to find a table whose attribute is 1 Start incremental . They usually use mysql.help_topic This table , But the data in this table id It is limited. , Even in some cases, you don't have permission to access the table .
边栏推荐
- [combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
- Basis of target detection (IOU)
- The mixlab editing team is recruiting teammates~~
- TCP拥塞控制详解 | 3. 设计空间
- Mongodb installation and basic operation
- How to initialize views when loading through storyboards- How is view initialized when loaded via a storyboard?
- Characteristic polynomial and constant coefficient homogeneous linear recurrence
- 深入理解 SQL 中的 Grouping Sets 语句
- Record a jar package conflict resolution process
- QT serial port UI design and solution to display Chinese garbled code
猜你喜欢

Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package

Zebras are recognized as dogs, and Stanford found the reason why AI made mistakes
![[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix](/img/d6/3c21c25f1c750f17aeb871124e80f4.png)
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix

PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug

A survey of state of the art on visual slam

One article takes you to understand machine learning

探索Cassandra的去中心化分布式架构

Mysql 单表字段重复数据取最新一条sql语句

QT serial port UI design and solution to display Chinese garbled code

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
随机推荐
Leetcode binary search tree
如何在本机搭建SVN服务器
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
高等数学(第七版)同济大学 习题2-1 个人解答
斑馬識別成狗,AI犯錯的原因被斯坦福找到了
8 tips for effective performance evaluation
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
TCP拥塞控制详解 | 3. 设计空间
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
面试之 top k问题
中南大学|通过探索理解: 发现具有深度强化学习的可解释特征
Deep understanding of grouping sets statements in SQL
Golang anonymous function use
8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
相同切入点的抽取
Pointcut expression
TCP congestion control details | 3 design space
Unity project optimization case 1
nifi从入门到实战(保姆级教程)——flow
[combinatorics] combinatorial identity (sum of variable upper terms 1 combinatorial identity | summary of three combinatorial identity proof methods | proof of sum of variable upper terms 1 combinator