Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Database: How to import data from another table ?

MupetzMupetz New
edited December 2011 in Vanilla 2.0 - 2.8

Hey guys,

Migrated from vBulletin4. This is table: gdn_user, column: Photo related.


I would like to import generated data from another table/column into gdn_user's Photo column.

Tried this: pastebin.com/pbvD23AB

But it fills the Photo column after the last user id

So, I have 5000 members, generated 5000 image paths. When filling with above command, it fills from 5001 to 10000.. grr
I would like to fill into existing ids.. from 1 to 5000

I'm sure there are some mysql gurus arouns here :)


Please, I would really appreciate a hand.

Thank you so much

Best Answer

  • ToddTodd Vanilla Staff
    Answer ✓

    You want to use an update command:

    update gdn_user u
    join `separate_table` u2
      on u.UserID = u2.userid
    set u.Photo = u2.`separate_column`;
    

Answers

  • ToddTodd Vanilla Staff
    Answer ✓

    You want to use an update command:

    update gdn_user u
    join `separate_table` u2
      on u.UserID = u2.userid
    set u.Photo = u2.`separate_column`;
    
  • Brilliant! Thanks a million Todd

Sign In or Register to comment.