$date2=UnixDate($date2,'%Y-%m-%d');
my $dbh = C4::Context->dbh;
-my $query="select *
+my $sth=$dbh->prepare("select *
from accountlines,accountoffsets,borrowers where
accountlines.borrowernumber=accountoffsets.borrowernumber and
(accountlines.accountno=accountoffsets.accountno or accountlines.accountno
=accountoffsets.offsetaccount) and accountlines.timestamp >=20000621000000
and borrowers.borrowernumber=accountlines.borrowernumber
-group by accountlines.borrowernumber,accountlines.accountno";
-my $sth=$dbh->prepare($query);
-$sth->execute;
+group by accountlines.borrowernumber,accountlines.accountno");
+$sth->execute();