update query on multiple tables
- by jon
I have a schema like :
employees (eno, ename, zip, hdate)
customers (cno, cnmae, street, zip, phone)
zipcodes (zip, city)
where zip is pk in zipcodes and fk in other tables.
I have to write an update query which updates all the occurence of zipcode 4994 to 1234 throughout the database.
update zipcodes,customers,employees
set zip = 0
where customers.zip = zipcodes.zip
and employees.zip = zipcodes.zip;
but i know i am not doing it right. Is there a way to update all the tables zip ina single update query?