I have two tables
TABLE : EMPLOYEE
EMP_ID EMP_NAME EMP_TYPE
1 Shwetha 1
2 Raj 1
3 Mani 1
4 Sita 2
5 Rani 3
6 Guna 2
TABLE : EMPMAP
MAP_ID (PK) EMP_ID EMPMAP_ID
1 1 4
2 4 5
3 1 6
In 2nd table it shows emp 4 is under 1, and 4 is under 5 and again 6 is under 1
I want to fetch employees who are working under a particular employee. For example, I want details of employees 4 and 5 if I pass empid 1 to the query and details of 5 if I want for 4.
Can anyone tell me how can I write the query for this?
1 Answer