Hello all,
I have the below update query, updating some data from table1 to table2 when the later are missing.
But some times some of these data are not stored in the table1 but in another table, table3.
So I would like to know if there is a way to run at first the first query and if it doesn't find any values, to look in the table3 for these data.
Probably if I run the same query but with the table3 instead of table1 could work and I may be able to do it with a subquery but I don't know exactly the way.
Can you please help? Thanks!
UPDATE table1 INNER JOIN table2
ON
(table1.CODE = [table2].CODE)
AND
(table1.MDATE = [table2].MDATE)
SET
[2table2].HOME = [table1].[HOME],
WHERE
([table2].HOME) Is Null);
I have the below update query, updating some data from table1 to table2 when the later are missing.
But some times some of these data are not stored in the table1 but in another table, table3.
So I would like to know if there is a way to run at first the first query and if it doesn't find any values, to look in the table3 for these data.
Probably if I run the same query but with the table3 instead of table1 could work and I may be able to do it with a subquery but I don't know exactly the way.
Can you please help? Thanks!
UPDATE table1 INNER JOIN table2
ON
(table1.CODE = [table2].CODE)
AND
(table1.MDATE = [table2].MDATE)
SET
[2table2].HOME = [table1].[HOME],
WHERE
([table2].HOME) Is Null);