In My employee table i have NoOfeligiblechildSchoolFee field ,its number is different for each employee. i want to select child details from another table(Dependent Table) based on NoOfeligiblechildSchoolFee field
Employee Table
Emp_ID,EmpName,NoOfeligiblechildSchoolFee etc
Data
1 3 Alan
1 2 Bibin
1 2 Cibin
(Dependent Table)
Dependent_ID,Emp_ID,ChidName etc
1 1 alan1
2 1 alan2
3 1 alan3
4 1 alan4
5 2 Bibin1
6 2 Bibin2
7 2 Bibin3
8 3 Cibin1
9 3 Cibin2
9 3 Cibin3
for the first employee 3 kid,sec employee 2 kid,third employee 2
Fetch Dependent data for employee's based on NoOfeligiblechildSchoolFee number
Aravind GovindarajPosted Nov 25, 2022, 3:15 PM
I assume you need to use the SQL rank concept and the condition suppose to be rank <= NoOfeligiblechildSchoolFee. let me know if you need any more info on the same.
Sachin SinghPosted Nov 26, 2022, 11:59 AM
Here is the solution
Test data for your reference:-