Php 如何获取每天laravel postgres的站点交易
我想计算我在我的网站上每天的交易总额,以下是我计算交易总数的方法:Php 如何获取每天laravel postgres的站点交易,php,laravel,postgresql,Php,Laravel,Postgresql,我想计算我在我的网站上每天的交易总额,以下是我计算交易总数的方法: $results = Transaction::select(\DB::raw("TO_CHAR(created_at, 'YYYY-MM-DD') AS month, COUNT(*) AS count")) ->groupBy(\DB::raw("TO_CHAR(created_at, 'YYYY-MM-DD')")) ->get(); retu
$results = Transaction::select(\DB::raw("TO_CHAR(created_at, 'YYYY-MM-DD') AS month, COUNT(*) AS count"))
->groupBy(\DB::raw("TO_CHAR(created_at, 'YYYY-MM-DD')"))
->get();
return $results;
我目前正在计算,没有任何问题,但我想得到字段amount
的总和。现在,我如何获得每天的总和amount
,以查看我的应用程序每天有多少交易。像在count之外添加sum(amount)
在DB::raw()中添加sum(amount)