pub fn total<'a, V, E>(
expr: E,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Double, NonNull, Agg>where
V: SQLParam + 'a,
V::DialectMarker: SQLiteAggregateSupport,
E: Expr<'a, V>,
E::SQLType: Numeric,Expand description
TOTAL - sums numeric values, returning 0.0 for empty sets (SQLite).
Unlike SUM, which returns NULL for an empty result set,
TOTAL always returns a floating-point value (0.0 for empty sets).
ยงExample
use drizzle_core::expr::total;
// SELECT TOTAL(orders.amount)
let total_amount = total(orders.amount);