Suppose I have 3 tables parent, child1 and child2.
The parent table may look as follows:
+--------+-----------+-----------+
| Column | Child1_Id | Child2_Id |
+--------+-----------+-----------+
| Name1 | 1 | 1 |
+--------+-----------+-----------+
| Name1 | 2 | 2 |
+--------+-----------+-----------+
| Name2 | NULL | 3 |
+--------+-----------+-----------+
| Name1 | 4 | 4 |
+--------+-----------+-----------+
| Name2 | 5 | 5 |
+--------+-----------+-----------+
Currently I have tried this:
SELECT Parent.*, Child_1.*, Child_2.*
FROM Lead INNER JOIN
Child_1 ON Parent.Child1_Id = Child1.Id INNER JOIN
Child_2 ON Parent.Child2_Id = Child_2.Id
The problem is, that I only get returned 4 records, but optimally it should return 5 records.
I believe it is because, Child1_Id is Null. However, I still want my records from Child2_Id.. Is there any way to achieve this?