I'm currently making SQL that'll update data from 1 table, based on data from another table for my company
update table1
set column1 = (SELECT color
FROM table2
Where table1.id = table2.id)
My goal is to make table1
's column 1
to consist of the colors from table 2
, however the id
is not unique, instead it's cvr of the companies, therefore they appear multiple times giving me the error "single-row subquery returns more than one row"
. The duplicates can have different colors however, making me unsure on how to tackle this, any suggestions?
Also it would seem that while duplicates can be differnet colors, in 99% of all instances they don't, so if the first isn't possible, would there be a way for me to update, so all duplicates have same color?