Table1: ID,Name,some more columns
Table2: ID
Table3: Name
I want get output from table1, whose IDs are present in Table2.IDs & whose Name are present in Table3.Name.
In other words, select data which is present in ALL the 3 tables.
For ex:
Table1:
1 John
2 Will
3 Michael
Table2:
1
Table3:
Will
The output should be
1 John
2 Will
You need to use JOINs.
Your description and your sample output do not match, so I’ll give you one example for each.
Based on your description, it should be 2 INNER JOINs:
Based on your output, it should be 2 OUTER JOINS with a WHERE clause specifying that at least one of the 2 joins was satisfied: