版本: v2.3.0
sum
计算指定列的总和。
sum($table, $column, $where)
table [string]
要查询的数据表名称。
column [string]
要计算的列。
where [array] (可选)
用于筛选结果集的 WHERE 条件。
sum($table, $join, $column, $where)
table [string]
要查询的数据表名称。
join [array]
用于关联相关数据表的 JOIN 定义;如果不需要 JOIN,可省略此参数。
column [string]
要计算的列。
where [array] (可选)
用于筛选结果集的 WHERE 条件。
返回值
[mixed] 返回指定列的求和值。
$total = $database->sum("account", "money");
echo "Total amount: {$total}";