mysql - Create new records from a field with comma delimited values -
i have poorly created table want update. set as
- id
- name
- value
because given name can have more 1 value right value field varchar , populated comma delimited values:
- 12,15,92
i create update or create table query make separate records table with
- id | name | value
- 1 | bob | 5,6,9
- 2 | alice| 5,9
- 3 | ted | 1
ends as
- 1 | bob | 5
- 2 | bob | 6
- 3 | bob | 9
- 4 | alice | 5
- 5 | alice | 9
- 6 | ted | 1
in searching online appear pretty common issue , found 1 of several functions splitting delimited fields records here:
http://kedar.nitty-witty.com/blog/mysql-stored-procedure-split-delimited-string-into-rows
Comments
Post a Comment