UPDATE Based Off of A Table

  • 1

UPDATE Based Off of A Table

visit : http://www.zonixsoft.com (our official website)

 INSERT offers the ability to insert into a table based upon a SELECT statement with the following syntax:

INSERT INTO [TABLEA] ([FIELDA],[FIELDB],[FIELDC])
        SELECT [FIELDA],[FIELDB],[FIELDC]
FROM [TABLEB]

 

there are time where you may want to do a similar approach with UPDATE.
Here is the syntax to do that very task:

UPDATE [TABLEA]
        SET  [TABLEA].[FIELDA] = [TABLEB].[FIELDA]
               [TABLEA].[FIELDB] = [TABLEB].[FIELDB]
               [TABLEA].[FIELDC] = [TABLEB].[FIELDC]
        FROM [TABLEA]
               JOIN [TABLEB]
        ON [TABLEA].[KEYA] = [TABLEB].[KEYA]

 


Bookmark and Share


1 Comment

web design London

August 14, 2009 at 11:28 am

Thank you very much for this useful information.
Please keep on blogging.
I am looking forward to read your next great article. web design London

Best regards!!!
Sam

Leave a Reply