I have two tables employee_personals
where all the personal record of the employee is stored and telephone_bills
where the telephone bills paid to a pa
TLDR: use Joins instead.
Details/Notes:
1) it looks like you're using recursive
. Don't do that. Use Containable instead.
2) You can't limit the parent model based on conditions against data from a contained/recursive-included table - instead, use Joins.
2b) Or, you could query from the other direction, and query your TelephoneBill
with conditions, then contain the EmployeePersonal
.