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