@@ 58,7 58,7 @@ class CustomerUsage date_trunc('day', start)::date as day,
CEIL(SUM(billsec)/60.0)::integer as minutes
FROM cdr
- WHERE customer_id=$1 and start >= $3 and start < $2
+ WHERE customer_id=$1 and start >= $3 and date_trunc('day', start) <= $2
GROUP BY date_trunc('day', start);
SQL