**TableFruits** **TableNames**
RecId RId FruitId Price RId FruitId Name
1 A1 Null 3$ A1 1 Mango
2 A2 2 4$ A2 2 Tomato
Since there is Null under FruitId in TableFruits I want to fetch it from TableNames like
Select a.RecId,a.RId,b.FruitId from TableFruits a INNER JOIN TableNames b on a.RId=b.RId
- How do I apply a join in this SQL statement to include FruitNames from Table 2 (I cannot change the order of tables)
Since you can have mismatches in
RId, you need an outer join.LEFT,RIGHTorFULL, depending on which side the mismatches can occur.MySQL does not have
FULL JOIN, so you can do something like this: