How to migrate comma separated values from one table to another table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anil2083
    New Member
    • May 2010
    • 5

    How to migrate comma separated values from one table to another table?

    How to migrate the comma separated values from one table to another table?
    suppose we have table i.e XYZ and we have comma separated values in few columns i.e( column_name and values are A,B,C,D).Now i have to migrate these comma separated values into new table i.e PQR.

    Example:
    Table1
    column_name1 complexion
    values : VF,F,AVG etc..
    column_name2 profession
    values : TEA,LECT etc...

    now i want to migrate into another table:Table2
    column_name1 complexion
    values:VF
    values:F
    values:AVG

    column_name2 profesion
    values:TEA
    values:LECT
  • dgreenhouse
    Recognized Expert Contributor
    • May 2008
    • 250

    #2
    Originally posted by anil2083
    How to migrate the comma separated values from one table to another table?
    suppose we have table i.e XYZ and we have comma separated values in few columns i.e( column_name and values are A,B,C,D).Now i have to migrate these comma separated values into new table i.e PQR.

    Example:
    Table1
    column_name1 complexion
    values : VF,F,AVG etc..
    column_name2 profession
    values : TEA,LECT etc...

    now i want to migrate into another table:Table2
    column_name1 complexion
    values:VF
    values:F
    values:AVG

    column_name2 profesion
    values:TEA
    values:LECT
    I'm unclear on what you are asking. From the looks of it, you're trying normalize the column values. Is this correct? Or are you truly trying to transfer the records from one table to another? If you're trying to normalize, then you'll need to parse out each value and insert with a non-unique key into the receiving table. If you want to just transfer "as is", then just do a record transfer - possibly using MySQL's: INSERT ... SELECT statement.

    Comment

    • anil2083
      New Member
      • May 2010
      • 5

      #3
      yes,i am trying to normailize.but how to parse out each value and insert with a non unique key into the reciving table?

      Comment

      • dgreenhouse
        Recognized Expert Contributor
        • May 2008
        • 250

        #4
        You could try PHP's str_getcsv function...

        Comment

        Working...