SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Moving a Table into Another Table

    I created a database with one table that has all my important data. Then I installed an open source application, 4images, into that same database. Now I need to make the information in the original table MOVE into the right places in the 4images tables.

    I am trying to use phpmyadmin, but I can't figure it out.

    Here's more info about my data:
    It has about 2000 records and about 25 columns. One of the columns is simply an "index" or "key." (I think that is what you call it.) It is a numeration of each record.

    If I could just learn to put one of the columns in my original table into the 4images table where it needs to go, I think I could do the others.

    I hope this makes sense and someone can help me get started.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Code:
    insert
      into `4images `
         ( foo
         , bar )
    select qux
         , fap
      from origtable;
    
    drop 
     table origtable;
    of course, you would take a backup of both tables before trying this, yes?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    Code:
    insert
      into `4images `
         ( foo
         , bar )
    select qux
         , fap
      from origtable;
    
    drop 
     table origtable;
    of course, you would take a backup of both tables before trying this, yes?
    Well, I am not so worried about a backup because the 4images is a fresh install and could be repeated again easily, and because my important data is saved on my computer and could also be recreated easily. I am at the beginning stages of this and don't expect it to work the first time at all.

    I think that in your example foo would be the name of the ImportantTable and bar would be the name of the important table's column, such as Title.
    But what is qux and fap? 4images and images maybe .... hmmm.

    But that looks like it might change the way 4images_images is designed? What I'm hoping for is to make a new column in 4images_images called 4images_Title.

    I am really very mixed up. Maybe I should come back when I know a little bit more about what I am trying to do.

    Another question I have is should I have prefixed my 4images installation with the same prefix as my original table, say ImportantTable?

  4. #4
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    edited
    Last edited by panachepad; Jun 4, 2007 at 09:03. Reason: doesn't work

  5. #5
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    edited
    Last edited by panachepad; Jun 4, 2007 at 09:03. Reason: doesn't work


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
  •