Helpful Information
 
 
Category: MS SQL Development
sql riddle

I have 2 tables the first table custAddress contains the fields recordNum,
first name, last name, address, city, state, zip, phone
the second table called corrected_info and contains recordNum, first name,
last name, address, city, state, zip but no phone
how would I update custAddress with the corrected info in the second table
without losing the phone numbers? I need to do this in sql. if anyone has an
idea please let me know. TIA

shom@autographsolutions.com

Something like this perhaps:


UPDATE ca
SET ca.first_name = ci.first_name,
ca.last_name = ci.last_name,
ca.address = ci.address,
ca.city = ci.city,
ca.state = ci.state,
ca.zip = ci.zip
FROM custAddress AS ca
INNER JOIN corrected_info AS ci
ON ca.recordNum = ci.recordNum


DISCLAIMER: I have not actually tested the above statement. Back up your data before trying it out. Hope this helps :)










privacy (GDPR)