ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 记录数量 count ~~~ # 函数原型 public function getCount($strField = '*', $sAlias = 'row_count') # SELECT COUNT(`test`.*) AS row_count FROM `test` LIMIT 1 database::table ( 'test' ) ->getCount(); ~~~ # 平均值 avg ~~~ # 函数原型 public function getAvg($strField, $sAlias = 'avg_value') # SELECT AVG(`test`.`id`) AS avg_value FROM `test` LIMIT 1 database::table ( 'test' ) ->getAvg('id'); # SELECT AVG(`test`.`num1`*`test`.`num2`) AS avg_value FROM `test` LIMIT 1 database::table ( 'test' ) ->getAvg('{[num1]*[num2]}'); ~~~ # 最大值 max ~~~ # 函数原型 public function getMax($strField, $sAlias = 'max_value') # SELECT MAX(`test`.`num`) AS max_value FROM `test` LIMIT 1 database::table ( 'test' ) ->getMax('num'); ~~~ # 最小值 min ~~~ # 函数原型 public function getMin($strField, $sAlias = 'min_value') # SELECT MIN(`test`.`num`) AS min_value FROM `test` LIMIT 1 database::table ( 'test' ) ->getMin('num'); ~~~ # 合计 sum ~~~ # 函数原型 public function getSum($strField, $sAlias = 'sum_value') # SELECT SUM(`test`.`num`) AS sum_value FROM `test` LIMIT 1 database::table ( 'test' ) ->getSum('num'); ~~~