I have 3 tables looked like this
Employee Table
id | EmpId | Name |
1 | N1 | A |
2 | N2 | B |
3 | N3 | C |
Leave Table
id | EmpId | applydate | startdate | daysleave | reason | status |
1 | N2 | 2016-08-25 | 2016-08-25 | 4 | vacation | Approved |
Setting Table
id | var | val | valdef | status |
1 | MaxLeave | 12 | 12 | 1 |
Each employee has max leave 12 days taken from Setting Table.
If daysleave = 4,then maxleave it should be 8 days left.
how did i do that ?should i add new field on Employee Table ?
Result Expected :