I have the following scenario:
Database A.table A.name
Database A.table A.Application
Database B.table B.name
Database B.table B.Application
Database C.table C.name
Database C.table C.Application
I’m trying to write an UPDATE query that will set a value to table A.Application. The value I need to update it with could come from tables B or C but not both; A.name only exists in either B or C. The condition for each row I would need to update on would be as so:
If B.name exists for A.name, set A.Application = B.application
If C.Name exists for A.name, set A.application = C.application
I’m trying to do this non-dynamically; any assistance would be appreciated.
You can do it in two statements:
Only one of them will actually do anything to the data, assuming the names in B and C are truly orthogonal. Otherwise, C wins.
Or you could get fancy (without having actually tried it):