Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Add Data To New Column?

forums forums SQLyog Using SQLyog Add Data To New Column?

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #9301
      golfguy
      Member

      I need to add a column to a table and propagate the data in the column. adding an empty column is not big deal, getting the data in has me stumped

      The data is very simialar to a column already in the table (image path and thumbnail path), so either exporting the existing image column and importing it as the new thumb column, or copy and paste kind of logic would work.

      I tried copying the table, adding an empty column calling it image, altering the column name of image, to thumb, and then using Data Sychonizaation Wizard to populate the thumb column, but as it populated the thumb column it wiped out the image column.

      I somehow need to get two copies of the image column in one table. I can then alter the thumbnail file names (append a suffix).

      Any Ideas? :huh:

    • #19519
      peterlaursen
      Participant

      You use SQL for this!

      Code:
      Update mytable set newcolomn = oldcolumn;

      or if you want to copy and add the suffix in one operation

      Code:
      Update mytable set newcolomn = concat(oldcolumn,'.suffix');

      NOTE: there is no WHERE in the statement.

      In SQL NO WHERE means EVERYWHERE. 😀

    • #19520
      golfguy
      Member

      Brilliant! (as the Guinness guys would say).

      I should have posted sooner. 😀 Thanks!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.