I am trying to do the following task. I have 2 tables with following data?
Table1 :
objectid name LOCATION Project Manager
4584 Client NULL Indicator
4591 Ericsson NULL Indicator
4604 NEW201 Text NULL
Table2:
projectobjectid name value
4584 Indicator Red
4591 Indicator Green
4604 Text Sf001-bb1-5
4604 Text Sf001-bb1-4
4604 Text Sf001-bb1-3
4604 Text Sf001-bb1-2
result as follows:
objectid name LOCATION Project Manager
4584 Client NULL Red
4591 Ericsson NULL Green
4604 NEW201 Sf001-bb1-5 NULL
4604 NEW201 Sf001-bb1-4 NULL
4604 NEW201 Sf001-bb1-3 NULL
4604 NEW201 Sf001-bb1-2 NULL
Update Table 1 from Table 2.
You can do this with two
left join
s, one for each column you want to replace:SQL Fiddle Demo