Update Query problem for multiple tables

  • Dear All,

    I have a query regarding Update statement..

    1 > There are 2 tables ,Table 1 ,Table 2

    in Table 1 -- columns (ID,Email)

    in Table 2 -- Cloumns (EmpID,Email,Age,Status...)

    2> I want an update statement

    where

    update table 1

    set table 1.Email = table2.Email

    where table1.ID = table2.EmpID

    Error : The multi-part identifier "table2.EmpID

    " could not be bound.

    pls give me a solution

  • You need to reference both tables:

    update table1

    set table1.Email = table2.Email

    FROM table1 INNER JOIN table2 ON table1.ID = table2.EmpID



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply