Im trying to update a table with values by writing one query. I have a table that is missing name, address, phone, city, state and I have another table that has this missing information. Each table share a common field called customerno.
How can I write a query so all the data in the table that has the information will update the table that does not have the information... without having to go one by one.
I'm getting my data with this:
select ccustno, rtrim(cfname) + ' ' + rtrim(clname), caddr1, caddr2,ccity,cstate,czip,cphone1,cfax from dbo.arcust_10_27_08 where ccustno = @ccustno
Then I want to update my other table with this:
set ccontact = @contact
, cphone = @phone
, cfax = @fax
,caddress = @address
, caddress2 = @address2
, ccity = @city
, cstate = @state
, czip = @zip
where ccustno = @ccustno
How can I combine the 2 queries to update 700 records at once?