select 中使用 FROM_UNIXTIME (create_time,'%Y-%m'') 无法查出时间问题
DB::table('billing_details')
->select(
DB::raw("SUM(amount) as sum_amount"),
DB::raw("FROM_UNIXTIME(create_time,'%Y-%m')"))
->groupBy("FROM_UNIXTIME(create_time,'%Y-%m')")
->get();
这样使用 报vsprintf(): Too few arguments错误
DB::table('billing_details')
->select(
DB::raw("SUM(amount) as sum_amount"),
DB::raw("FROM_UNIXTIME(create_time,'%%Y-%%m')"))
->groupBy("FROM_UNIXTIME(create_time,'%%Y-%%m')")
->get();
多加个%号,查询结果为
求助~!
推荐文章: