简体   繁体   English

Mysql中什么解决函数Postgresql regexp_split_to_table

[英]What solution function Postgresql regexp_split_to_table in Mysql

In PostgreSQL have a function 在PostgreSQL中有一个功能

Select id, regexp_split_to_table(meta_value) from metas;

Date: 日期:

1, '45,46,47'
2, '10'
3, ''
4, '12,4558,456'

Need same result 需要相同的结果

1, '45'
1, '45'
1, '47'
2, '10'
3, ''
4, '12'
4, '4558'
4, '456'

What Solution for Mysql? Mysql有什么解决方案?

Is link One Column but result in one column, need two or more columns 是链接一栏但导致一栏,需要两栏或更多栏

Try using substring_index function 尝试使用substring_index函数

select   id,   substring_index(substring_index(meta_value, ',', n),     ',',     -1  
) as meta_value
from metas join metas   on char_length(meta_value)     - 
char_length(replace(meta_value, ',', ''))     >= n - 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM