ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
* [ ] 功能 * 获取最大值 * 参数 | 参数名 | 参数类型 | 参数说明 | 默认值 | | :---: | :---: | :---: | :---: | | $field | string | 统计的字段名 | 空字符 | | $mode | string | 查询模式,返回执行结果,或返回 查询 sql 语句 | 空字符,当设置为 demo ,返回 sql 语句 | | $type | string | 数据库类型 | 空字符 | | $come | string | 执行模式 | 空字符 | * 场景:user 数据库的 user_account 表有 3 条数据,数据为: user_account 表 | uid | username | | :---: | :---: | | 1 | 张三 | | 2 | 李四 | | 3 | 隔壁老王 | * 用法: ~~~ // 查询条件 $where = array( 'uid[>]' => 1, ); // 需要统计的字段名称 $field_name = 'uid'; $sum_num = mysql\User::table('account')->where( $where )->max( $field_name ); ~~~ 执行的 sql 语句: ~~~ select max(uid) as count from user.user_account where uid > 1 ~~~ 查询结果: ~~~ 3 ~~~