迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
count 是否可以用于字段数值求和统计
比如新闻表里自定义字段toubi有多个数据,每个里面的数字都不同。要求所有新闻表里toubi字段里数据的总和。能用么,该怎么写调用
$builder->selectSum()
Writes a “SELECT SUM(field)” portion for your query. As with selectMax(), You can optionally include a second parameter to rename the resulting field.
$builder->selectSum('age');$query = $builder->get(); // Produces: SELECT SUM(age) as age FROM mytable
$builder->selectSum()
Writes a “SELECT SUM(field)” portion for your query. As with selectMax(), You can optionally include a second parameter to rename the resulting field.