Click here to Skip to main content
15,881,755 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have tableA and tableB which can join by ids. I am trying to figure out how to write it such that I can select the tableA.color and tableB.value and do an update for the column in tableA called color that will get changed from "blue" to "red" for a row but only if the column in tableB called value is greater than 10.

so the result set


color value
blue 7
blue 3
red 12
blue 1
red 14


What I have tried:

I was thinking something along the lines of

<pre>select tableA.color, tableB.value
from tableA
inner join tableB on tableA.id = tableB.id
update tableA
set tableA.color = "red"
where tableB.value > 10


Wasn't sure on syntax and including the join.
Posted
Updated 21-May-18 21:19pm
Comments
Mohibur Rashid 21-May-18 22:52pm    

1 solution

Check this: Oracle / PLSQL: UPDATE Statement[^]
There you'll find a way to update data based on values in second table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900