版本: v2.3.0
max
回傳指定欄位的最大值。
max($table, $column, $where)
table [string]
要查詢的資料表名稱。
column [string]
要計算的欄位。
where [array] (可選)
用於篩選結果集的 WHERE 條件。
max($table, $join, $column, $where)
table [string]
要查詢的資料表名稱。
join [array]
用於關聯相關資料表的 JOIN 定義;如果不需要 JOIN,可省略此參數。
column [string]
要計算的欄位。
where [array] (可選)
用於篩選結果集的 WHERE 條件。
回傳值
[mixed] 回傳指定欄位中的最大值。
$max = $database->max("account", "age", [
"gender" => "female"
]);
echo "年齡最大的女性使用者為 {$max}";