getting comma separated string in a column for a large number of comma separated values efficiently in mysql -


i have sql table likes this: 1[sql table image]1

i using following query single comma separated value :

select substring_index(substring_index(name, ',', numbers.n), ',', -1) name   (select 1 n union select 2    union select 3 union select 4 union  select 5 union select 6) numbers inner join mytable   on char_length(name)      -char_length(replace(name, ',', ''))>=numbers.n-1 substring_index(substring_index(name, ',', numbers.n), ',', -1) = 'm'; 

i wondering if there better way not work large number of comma separated values using select 1 n union select 2 , on more 1 comma separated value

yes, there better way. convert tables , data 3nf table layout. way easier write queries database.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -