1. First Create the Database
2. Then create the tables
3. Insert the data
4. I would like to merge Table1, Table2 and Table3 based on matching ID's.
Table Data is:
Table1

Table2

Table3

Destination

5. The logic and the expected result is:
|
IF ID is found THEN
return field1 OR field2 OR field3 from Table1 OR Table2 OR Table 3
ELSE
return values from DESTINATION table
END IF
|
| id |
field1 |
field2 |
field3 |
| 1 |
a |
b |
c |
| 2 |
d |
e |
f |
| 3 |
g |
h |
i |
| 4 |
j |
k |
l |
6. The actual result we get after executing the query:
