Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    15

    Unanswered: Update table from values in another..

    Hi ya,

    I need to update two columns in one table from information in another table..

    Table1

    ID, UserID

    Table2

    ID, NewUserID

    How can I write this update statment?

    Thanks!

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Something like:

    Code:
    USE Northwind
    GO
    
    CREATE TABLE myTable99 ([ID] int Identity(1,1), UserId varchar(10))
    CREATE TABLE myTable00 ([ID] int Identity(1,1), NewUserId varchar(10))
    GO
    
        UPDATE A
           SET UserId = NewUserId
          FROM myTable99 A 
    INNER JOIN myTable00 B
            ON A.[ID] = B.[ID]
    GO
    
    DROP TABLE myTable00
    DROP TABLE myTable99
    GO
    Perhaps?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Apr 2003
    Posts
    15
    That worked awsome!

    Thanks for your help!

Posting Permissions

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