mysql - create table from comma separated text -


There are some solutions to do this but my case is slightly different.
For example,

Data sample
Table: data

  Sud (big talk), start (big), end (Large), route (text) 123, 111, 112, '1111, 1112, 1113, 1114 '123, 114, 115,' 2221, 2222, 2223 '133, 121, 122, 331, 332, 333' / Code>  

Expected Result :
Need to create a table: newdata

  Sud (large), start ( Bigger, End (123, 1112, 1113 123, 111, 112, 1113, 1114, 123, 114, 115, 2221, 2222 123, Road 1 CG1 (Int), Road_sG2 (Int.) 123, 111, 112, 1111  


So let me know {1} {{0}

Before The second, second, will be required, {second, third}, {third, fourth} ... route (text) objects can be probed up to 100 objects, but the objects Total number is random
Any help would be greatly appreciated I am using MySql Thank you.

If such a junction has a limited number, you can do this rather complicated query:

  select d.suid, s.start , S.en D, substring (substring_index (path, ',', nn), ',', -1) in the form of road_seg1, sub string (substring_index (path, ',', nn + 1), ',', -1 ) From data de cross joins as Road_sage2 (choose 1 as N union, select all 2 teams 3) (route, ',', ',' x)) - length (route) & lt; = Nn; Nth and nth + 1 items are being removed from the nested call string of  

substring_index () . The total number of items to be searched for the query is defined by subquery n (in this case, 3 but you can add more value) Choices of where section n is less than the number of items in the list.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -