Actually facing prob in join...
"agents_details" Table structure: "Agent_Id"(PK),"Agent_Emp_Id"...
Foreign key "Agent_Emp_Id" from "employee_details.Employee_Id"
"employee_details" structure: "Employee_Id"(PK),"Emp_Name","Emp_Mname"....
"employee_status" structure: "Emp_Id"(pk),"Emp_Acc_Stat"....
Foreign key "Emp_Id" from "employee_details.Employee_Id"
now it's required to to fetch the agent name(i.e. employee_details.Emp_Name) and agent_Id(i.e.agents_details.Agent_Id) whose employee_status.Emp_Acc_Stat=='OPEN'
i've done them in 2 steps..i.e. in my 1st query i've fetched agent id which supports the condition and in next step i've fetched the name of agents which satisfy the cond...
now need to combine and require in 1 table....
:
"select agents_details.Agent_Employee_Id,agents_details.Agent_Id from agents_details where Agent_Employee_Id=any(select Emp_Id from employee_status where Emp_acc_Stat='OPEN') "
Another query:
"select Employee_Id,Emp_Name,Emp_Mname,Emp_Lname from employee_details where Employee_Id=any(select agents_details.Agent_Employee_Id from agents_details where Agent_Employee_Id=any(select Emp_Id from employee_status where Emp_acc_Stat='OPEN') ) "
need Agent_Id,Emp_Name in 1 table
kindly help i'm new in sql