当前位置:网站首页>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 .
边栏推荐
- Visual SLAM algorithms: a survey from 2010 to 2016
- Record windows10 installation tensorflow-gpu2.4.0
- Leetcode binary search tree
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
- Golang decorator mode and its use in NSQ
- 于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
- From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing
- Add color to the interface automation test framework and realize the enterprise wechat test report
- Mb10m-asemi rectifier bridge mb10m
猜你喜欢

Mixlab编辑团队招募队友啦~~

Explore Netease's large-scale automated testing solutions see here see here

【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事

(补)双指针专题
![[redis foundation] understand redis persistence mechanism together (rdb+aof graphic explanation)](/img/68/3721975cf33fcfacc28dc4d3d6a5ca.jpg)
[redis foundation] understand redis persistence mechanism together (rdb+aof graphic explanation)

Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs

Mysql 将逗号隔开的属性字段数据由列转行

Cocos Creator 2. X automatic packaging (build + compile)

NSQ源码安装运行过程

TCP congestion control details | 3 design space
随机推荐
Data driving of appium framework for mobile terminal automated testing
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
Explore Netease's large-scale automated testing solutions see here see here
Unreal_ Datatable implements ID self increment and sets rowname
Leetcode binary search tree
TCP擁塞控制詳解 | 3. 設計空間
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 (I)
什么是质押池,如何进行质押呢?
Mongodb installation and basic operation
Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
Zebras are recognized as dogs, and Stanford found the reason why AI made mistakes
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
中南大学|通过探索理解: 发现具有深度强化学习的可解释特征
NSQ源码安装运行过程
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
MongoDB 的安装和基本操作
Cocos Creator 2. X automatic packaging (build + compile)
First knowledge of database