select Emp_id,Emp_name, (select Emp_name from tblEmployee tb inner join tblRelatives tr on tb.Emp_id=tr.Relatives_id where tb.Emp_gender='Male') as father, (select Emp_name from tblEmployee tb inner join tblRelatives tr on tb.Emp_id=tr.Relatives_id where tb.Emp_gender='Female') as mother from tblEmployee where Emp_id in(Select distinct Emp_id from tblRelatives)