Can Mysql Split a column?

前端 未结 7 1619
别那么骄傲
别那么骄傲 2020-11-22 03:00

I have a column that has comma separated data:

1,2,3
3,2,1
4,5,6
5,5,5

I\'m trying to run a search that would query each value of the CSV s

7条回答
  •  一整个雨季
    2020-11-22 03:20

    It's working..

    SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(
    SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(col,'1', 1), '2', 1), '3', 1), '4', 1), '5', 1), '6', 1)
    , '7', 1), '8', 1), '9', 1), '0', 1) as new_col  
    FROM table_name group by new_col; 
    

提交回复
热议问题