Check `mi_deleteDate` in subquery
Currently, query like this:
this.$UB.Repository('app_casePerson')
.attrs('personID')
.where('caseID', '=', this.caseID)
.where('personID', 'notIn', this.$UB.Repository('app_arrest')
.attrs('personID')
.where('incidentID', '=', this.incidentID)
)
generate this SQL:
SELECT A01.personID
FROM app_casePerson A01
WHERE A01.caseID=3000000010910
AND A01.personID NOT IN (
SELECT A02.personID
FROM app_arrest A02
WHERE A02.incidentID=3000000010902
)
AND A01.mi_deleteDate>='9999-12-31'
Subquery does not have a where
condition for deleted records, and we need to add a mi_deleteDate>='9999-12-31'
condition to subquery manually.
It would be nice for UB to take this into account and add this where
condition for subqueries automaticaly.