Skip to content
Advertisement

Updating field value based on data across three separate tables

I have been trying to UPDATE the values of a field (IsException) from 0 to 1 in a table (g) based on corresponding data from a separate table (a) in two fields (name, date) when the combination of both appear in that separate smaller table. The problem I am running up against is that the ‘name’ field comes from two separate systems and does not match, however I have a third “translation” table (t) which should allow a 1:many relationship to help qualify the name discrepancy. So basically I want to use the table a data to drive the updates in the g table after adapting the name, so I think I would need a LEFT JOIN, but have not been able to get this to function properly.

Last attempt looks something like:

Sample data from the tables looks a bit like:

So the aim would be to get the second and third rows in table g to have the IsException flag field update from 0 to 1.

I’ve been staring at UPDATE and JOIN syntax for hours and poring over other similar queries, but haven’t been able to get this to function as intended. Any point in the right direction would be greatly appreciated.

Advertisement

Answer

Isn’t it just a straightforward case of 2 inner joins?

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement