avg
获得某个列字段的平均值
avg($table, $column, $where)
table [string]
表名.
column [string]
列字段
where (optional) [array]
WHERE 条件.
avg($table, $join, $column, $where)
table [string]
The table name.
join [array]
Table relativity for table joining.
column [string]
The target column will be calculated.
where (optional) [array]
The WHERE clause to filter records.
Return: [number] 平均值.
$average = $database->avg("account", "age", [ "gender" => "male" ]); echo "The average age of male user is " . $average;