Hello,
I found the $query->sum(col)
-statement, but this does not allow to restrict the records with WHERE.
How can I achieve this with kirby?
I tried
$where = 'user_id = "'.$userID.'" AND datum BETWEEN "'.$first_day_last_month.'" AND "'.$last_day_last_month.'"';
$sql = 'SELECT sum(dauer) as summe FROM arbeitszeiterfassung WHERE '.$where;
$sum = Db::query($sql);
and when I return a Db:lastQuery() I get a perfect SQL-Statement.
But when I return $sum->summe;
nothing is returned.