Copy content from one column to another in same table

Discussion in 'MySQL' started by pesst, Dec 11, 2011.

  1. #1
    Hi there! I have a MySQL DB about jewelry in Magento,

    I uploaded it with "short_description" field empty on purpose, but then the "add to basket button" is not shown in particular products.

    I would like to know a SQL query to copy "description" content to "short_description" per each product,

    Thanks in advance!!

    Ann Lee
     
    pesst, Dec 11, 2011 IP
  2. sMe76

    sMe76 Peon

    Messages:
    8
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To copy all the columns at once:
    "UPDATE mytable SET short_descripion = description"
     
    sMe76, Dec 11, 2011 IP
  3. upeshrajak

    upeshrajak Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    Here is example email is column.

    INSERT INTO table2 (email) SELECT email FROM table1 WHERE name=’ekram’;
     
    upeshrajak, Jan 16, 2012 IP
  4. iama_gamer

    iama_gamer Active Member

    Messages:
    404
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Since the OP has mentioned that it is in Magento, the queries get a little more complicated. You may need to reword the question since I think magento follows a EV structure and so the values wouldn't actually be columns in the same table. Please PM me for a more accurate answer since that would require some knowledge of the exact data.
     
    iama_gamer, Jan 26, 2012 IP