Updating 2 tables

6854933580_2c8b688306_z

------ ----------- ----------------- -------- ----------- ---------- | "id" | "name" | "description" | "type" | "country" | "status" | ------ ----------- ----------------- -------- ----------- ---------- | "1" | "Title 1" | "Description 1" | "1" | "US" | "0" | | "2" | "Title 2" | "Description 2" | "1 " | "UK" | "0" | ------ ----------- ----------------- -------- ----------- ---------- ------ ----------- ----------------- -------- ----------- ---------- | "id" | "name" | "description" | "type" | "country" | "status" | ------ ----------- ----------------- -------- ----------- ---------- | "1" | "Title 1" | "Description 1" | "1" | "US" | "2" | | "2" | "Title 2" | "Description 2" | "1 " | "UK" | "2" | ------ ----------- ----------------- -------- ----------- ---------- UPDATE table2 set status = 0 where id = spid and country = spcountry;//Update table2 first UPDATE table1 a INNER JOIN table2 b ON = and a.country = b.country SET a.status = b.status WHERE a.id=spid; but this could be harmful.Consider the following case: when TBL2 contains row with id = 2, while TBL1 does not have a row with id = 2. In order for this to work, TBL1 and TBL2 must be exactly the same.In this article, we are going to look at four scenarios for Oracle cross table update. Category_ID) where exists ( select * from Categories b where b. These columns uniquely identify a record in a table.

Here are the relevant clips from the MSDN documentation (emphasis is mine).

It does not stop your script from running but you need to enforce those conditions.

If two table is not consistence, so sometimes update will not work.

By commenting, you are accepting the DISQUS terms of service.

Now that you have created the Products table, you are ready to insert data into the table by using the INSERT statement.

When you sign in to comment, IBM will provide your email, first name and last name to DISQUS.

You must have an account to comment. Please register or login here!