1) The simplest form
SQL Code
--confirmed that all customer_id less than 1000 of the Customers table are ' Beijing '
--1000 within the company to the country before the old customers of the city:) update customersset city_name= ' Beijing ' where customer_id<1000
2) Two tables (multiple tables) associated update--only in the WHERE clause of the connection
SQL Code
--This time the extracted data are VIP and include new, so update the customer category updates customers A--using the alias set customer_type= ' 01 '--01 for vip,00 for normal where exists (select 1from tmp_cust_city bwhere b.customer_id=a.customer_id)
3) Two tables (multiple tables) associated update--the modified value is calculated by another table
SQL Code
Update customers A--using alias set City_name= (select B.city_name from tmp_cust_city b where b.customer_id=a.customer_id) where E Xists (select 1from tmp_cust_city bwhere b.customer_id=a.customer_id)--update more than 2 values update customers A--using alias set (City_na Me,customer_type) = (select B.city_name,b.customer_typefrom tmp_cust_city bwhere b.customer_id=a.customer_id) where Exists (select 1from tmp_cust_city bwhere b.customer_id=a.customer_id)
Oracle Multi-Table Association UPDATE statement