mysql merge two columns into one column

Discussion in 'MySQL' started by xbat, Dec 18, 2013.

  1. #1
    I am trying to merge two columns into one column. Not sure what I am doing wrong..


    here what I have
    id stuff something
    1 2 5
    0 2 1
    2 2 5
    3 2 5
    1 2 4

    What I want it to combine into

    THIS IS WHAT I WANT IT TO LOOK LIKE //////////
    stifething
    25
    21
    25
    25
    24

    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    What I tried...


    INSERT INTO test3 (combined)
    SELECT  test2column2  FROM test2
    UNION ALL
    SELECT two FROM test
    Code (markup):

    And what this did...

    stifething
    2
    5
    2
    1
    2
    5
    2
    5
    2
    4


    Any pointers or suggestions would greatly be appreciated.
     
    xbat, Dec 18, 2013 IP
  2. xbat

    xbat Well-Known Member

    Messages:
    326
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    105
    #2
    I figured this out.. It was as simple as... update test set third = concat(one,two);
     
    xbat, Dec 19, 2013 IP