Please help me to write this query. I faced this question in an interview.
tblEmployee
| Emp_id | Emp_Name | Emp_Gender |
| 1 | John | Male |
| 2 | Dean | Male |
| 3 | Mary | Female |
tblRelatives
| Emp_id | Relatives_Id |
| 1 | 2 |
| 1 | 3 |
Write a query to get the output given below.
| Emp_id | Emp_Name | Father | Morther |
| 1 | John | Dean | Mary |
Ananth GPosted Oct 31, 2016, 4:40 AM
Satish PatelPosted Nov 1, 2016, 1:01 PM
Midhun TpPosted Oct 30, 2016, 9:26 AM
You will get the desired output with below query -
But I'm not sure about what happens with more employees and more relations :)
Amit GuptaPosted Oct 29, 2016, 4:07 PM