Satish Patel
Write a sql Query as per given scenariostblEmployeeEmp_id Emp_Name Emp_Gender1 John Male2 Dean Male3 Mary FemaletblRelativesEmp_id Relatives_Id 1213 Write a query to get the output given below. Emp_id Emp_Name Father Morther1 John Dean Mary?
By Satish Patel in .NET on Nov 01 2016
  • Satish Patel
    Nov, 2016 1

    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)

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS