@@ -, +, @@ --- reports/borrowers_stats.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/reports/borrowers_stats.pl +++ a/reports/borrowers_stats.pl @@ -322,7 +322,7 @@ sub calculate { @$filters[7]=~ s/\*/%/g if (@$filters[7]); $strcalc .= " AND sort2 like '" . @$filters[7] ."'" if ( @$filters[7] ); $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) from old_issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'active'); - $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from old_issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'nonactive'); + $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from old_issues where issuedate > '" . $newperioddate . "' AND borrowernumber IS NOT NULL)" if ($activity eq 'nonactive'); $strcalc .= " AND $status='1' " if ($status); $strcalc .= " group by $linefield, $colfield"; push @loopfilter, {sql=>1, crit=>"Query", filter=>$strcalc}; --