I am trying to update a field from a value of 10 to a value of 20, unless a record for that City already is in the table with that value. I can do a straight update, but then I might get 2 records that are identical. I don't know how to code sql to do this.
If 'BBB' has 2 records, one with 10 and one with 20, I want to skip it and not make 2 records with a type of 20. So I need a way to exclude S_NAME = 'BBB' if a record already exists with a type of 20. This is not part of a key, so it does not give an error if 2 records have the same S_NAME and type value.
Code:
select * from zone z
set type_seq = 20
where S_NAME in ('AAA', 'BBB', 'CCC')
and type_seq = 10