I've three tables Table1 Table2 Table3. I've to perform some operations on them and store the resultant in Table4
Table1:
ID t1col2 t1col3
`````` `````` ``````
123 Fname1 Lname1
456 Fname2 Lname2
789 Fname3 LnameAA
Table2:
ID t2col2 t2col3 t2col4
````` `````` `````` ``````
122 Fname1 Lname1 String1
466 Fname2 Lname2 String2
789 Fname3 Lname3 String3
Table3:
ID t3col2
`````` ``````
122 querty
789 asdfgh
How can I perform conditional joins to check for following conditions:
- Search for a substring AA in
t1col3. - If found, replace
t1col3value from Table1 witht2col3value from Table2 only when Table1IDand Table2IDare equal. - From the above result, search for matching
IDin Table3 - If found, display the content in Table4 as mentioned below.
Expected output:
Table4:
ID t1col2 t2col3 t2col4 t3col2
``````` ``````` ``````` ``````` ```````
789 Fname3 Lname3 String3 asdfgh