1

Possible Duplicate:
how to do a split on a sql table column

I have a following MySQL table

(ID,my_string)
(1,"substrA,substrB,substrC")  
(2,"substrD,substrE")
...

is there some statment that would allow to split string into the individual substrings(separated by comma) and merge them with the corresponding ID?

like

(ID,substring)
(1,substrA)
(1,substrB)
(1,substrC) 
(2,substrD)
(2,substrE)  
...

thank you for advice in advance

Community
  • 1
  • 1

1 Answers1

0

check it:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index

  • I mean the question is is it possible to split string and connect resulting vector of values to ID without having to do this rowwise? – user1657412 Sep 09 '12 at 06:12
  • I mean the question is is it possible to split string and connect resulting vector of substrings to ID without having to do this rowwise. Or more general is it possible for each row (but by application of query to the full table) to generate some vector of values,repeat row n-times(n=length of the vector of values for the respective row) and then merge every single value in the vector to individual repetion of respective row. Its a question of a guy who just discovered MySQL. Or I have to do it in some programming language row by row? – user1657412 Sep 09 '12 at 06:28