The WHERE clause will filter out these rows because NULL values do not satisfy either the IS NULL or the greater than conditions, effectively excluding them from the result set.
Turning the LEFT JOIN into an INNER JOIN for rows where NULL values would have been expected.
move includeDeleted checks from query to join, where the filter will be applied
copy filters over and add filter as necessary, on case deleted in not included
keep includeDeleted checks within query aswell, as null checks now can exists in where clause aswell.
The WHERE clause will filter out these rows because NULL values do not satisfy either the IS NULL or the greater than conditions, effectively excluding them from the result set.
Turning the LEFT JOIN into an INNER JOIN for rows where NULL values would have been expected.