Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

Update sql statement for secondary table

SOLVED
Go to solution
Ratzie
Super Advisor

Update sql statement for secondary table

I have a two tables both linked by master_key, I need to update the secondary table based on criteria, I have been able to do the select statement but do not know how to do the update.

select mlr.tn, mlr_cable.CA
from mlr, mlr_cable
where mlr.bld ='VSSR'
and mlr.MASTER_KEY = mlr_cable.master_key
and mlr_cable.ca = '1103'

I need to update the cable to 11 where the cable = 1103 and bld = VSSR and master_key from primary table = master_key from secondary table
2 REPLIES
Jonathan Fife
Honored Contributor
Solution

Re: Update sql statement for secondary table

Use a subselect:

Update mlr_cable set ca = '11'
where ca = '1103' and master_key in (
select master_key from mlr where bld = 'VSSR')

Decay is inherent in all compounded things. Strive on with diligence
Ratzie
Super Advisor

Re: Update sql statement for secondary table

Thanks