Results 1 to 2 of 2

Thread: Ms Sql : Update From Select

  1. #1
    Join Date
    Apr 2006
    Posts
    178

    Ms Sql : Update From Select

    Hi

    how can you update many fields from a select ? :


    UPDATE table1 (a1,b1,c1) SELECT (a2,b2,c2) FROM table2 WHERE table1.id = table2.id


    for MS SQL 2000/25000

    thank you for helping

  2. #2
    Join Date
    Apr 2006
    Posts
    178
    if there is not a better method I think I got it :

    UPDATE table1
    SET a1=a2,b1=b2,c1=c2
    FROM table1 INNER JOIN table2 WHERE table1.id = table2.id

Posting Permissions

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