I have 3 columns of data:
- Column1 has duplicate values eg a a b b c c
- Column2 has all NULL values
- Column3 has other data that is not really important
I want to update Column2 with a value eh Hello but only for 1 instance of each value for column1. Eg, a = Hello but the 2nd instance of Hello is NULL, same with b c and so on.
I can find the distinct value by using this:
select distinct Column1
from TABLENAME
But when I try to update a different column it breaks. What is wrong (probably a lot!!) with this:
update TABLENAME
set Column2 = 'Hello'
where (select distinct Column1 from TABLENAME)