I am working in Oracle and trying to update a value in tableA to = 'Y' based on info from two other tables (B and C)
I have tried something like this which does work if I have only the first select statement but I need to exclude some records by using the second select statement.
update tableA set value1 = 'Y'
where tableB_ID in
(
select ID from tableB
where class in ('1','2')
)
and tableC_ID in
(
select ID from tableC where name not like 'MPG%'
)
Best Answer
I find
UPDATE
statements, with complexWHERE
clauses, are easier to understand, and maintain, when written as aMERGE
statement.Examples