SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast laresistance2's Avatar
    Join Date
    May 2011
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to update a single column of a table of data from a backup

    Hi,

    All the data in a column of a table of members have been erased, but I made a backup of the table a few weeks ago.

    So I need to replace only the data in this column by the old column in the backup of my table.

    The problem is that I do not know how I should proceed to do so.

    Have you been confronted by this problem and can you explain it to me.

    Thanks

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    UPDATE goodtable, backuptable
    SET goodtable.somecolumn = backuptable.somecolumn
    WHERE goodtable.primarykey = backuptable.primarykey
    the somecolumn of course being the name of the column you wanted updated. the primary key being one or more columns in order to identify the rows correctly.

  3. #3
    SitePoint Enthusiast laresistance2's Avatar
    Join Date
    May 2011
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •