I have 2 tables:
Each table contain fields called 'customer_depot_id' and 'address_id'.
What I want to do is update the address_id in the contacts table, with the value of the address_id in the customer_depots table, only where the customer_id values match in each table, AND the address_id in the contacts table is equal to zero.
Does this make sense?
So, update address_id in contacts,
where address_id in contacts = address_id in customer_depots
and address id in contacts = zero.
This is because a number of address_id's are missing from the contacts table, and I want to replace them with the correspondingvalue from the other table.
I have got as far as a SELECT statement, which goes someway to explain things, but I need an UPDATE statement like I have explained above.
SELECT cd.ADDRESS_ID FROM customer_depots cd, contacts con WHERE con.CUSTOMER_DEPOT_ID = cd.CUSTOMER_DEPOT_ID AND con.ADDRESS_ID = 0Hope someone can help