Changing Data Using the FROM Clause

Use the FROM clause to pull data from one or more tables or views into the table to update. For example, when author Dirk Stringer gets a contract, a title identification number is assigned to his book, The Psychology of Computer Cooking, in the titles table. Dirk’s row in the titleauthor table can be updated by adding a title identification number for this latest book.

This example updates Dirk Stringer’s row in the titleauthor table to add a title identification number for his latest book, entitled The Psychology of Computer Cooking:

UPDATE titleauthor

    SET title_id = titles.title_id

    FROM titles INNER JOIN titleauthor

        ON titles.title_id = titleauthor.title_id

        INNER JOIN authors

        ON titleauthor.au_id = authors.au_id

    WHERE titles.title = 'Net Etiquette'

        AND au_lname = 'Locksley'

  

To update data using UPDATE

See Also
FROM WHERE

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.