Updating table with data from another table

You’ve imported a table that contains updated prices for some of the records in a table in your database.

You probably already know that you can use an update query to update the values of fields in a table, but did you know that you can use an update query to update the values in one table with the values from another? If you can join the two tables on some common field or combination of fields, you can use an update query to update a field in one table based on the values found in a second table.PROC SQL ; UPDATE table1 AS a LEFT JOIN table2 AS b ON a.var1 EQ b.var1 SET a.var2 = b.var2 ; QUIT ; 65 LEFT JOIN ---- 79 76 ERROR 79-322: Expecting a SET.ERROR 76-322: Syntax error, statement will be ignored. As always, any help with this is greatly appreciated. Here are the steps to create an update query that updates values across tables: database.Note that most of the purchase prices are null (see Figure 1-15).This action query will take the Purchase Price values from tbl Albums Updated and copy it into the Purchase Price field in tbl Albums for each record where the two Album ID fields match and the price value in tbl Albums is currently null.When the query is finished, open tbl Albums again—you should see that the Purchase Price field in this table has been updated based on the values in tbl Albums Updated (see Figure 1-18). When you sign in to comment, IBM will provide your email, first name and last name to DISQUS.That information, along with your comments, will be governed by DISQUS’ privacy policy.The second table, Aliases, is made up of three fields, Alias ID, Product ID and Product Alias.Alias ID is the primary key and is also autonumbered.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating table with data from another table”