I have a table (custTAB) which has some zip codes missing, but has city, state names. I have a zipTAB which has a city, state and zip codes. My intent is to copy the missing zip codes from zipTAB to custTAB. However, for some reason my update doesn’t work as intended. If there were 10K NULL cust_zips, after the update I get 20K NULL cust_zips. Can someone check what’s going on? )
update custTAB
set cust_zip = (select zip
from zipTAB
where custTAB.cust_zip is null and
custTAB.cust_city = zipTAB.city and
custTAB.cust_state = zipTAB.state
limit 1
);
Thanks.
PS: The row numbers are edited for easier reading.
can you try this one? you need to join the two tables: