zoukankan      html  css  js  c++  java
  • thinkphp按日期(天)统计数据

    上善若水、 最后发布于2019-09-25 16:32:38 阅读数 305 收藏
    展开
    ··

    $data = $orderModel->alias('m')->field('FROM_UNIXTIME(m.enddate,"%Y-%m-%d") as enddate,count(m.id) as sn_sum,sum(m.real_price) as rmb_sum,sum(m.use_up) as use_up_sum,o.sn as machine_sn')
    ->join('__MACHINE__ o ON m.machine_id=o.id', 'LEFT')
    ->where($where)
    ->group('m.machine_id,FROM_UNIXTIME(m.enddate,"%Y-%m-%d")')
    ->order('m.enddate DESC')
    ->limit($start . ',' . $limit)
    ->select();
    $subQuery = $orderModel->alias('m')->field('FROM_UNIXTIME(m.enddate,"%Y-%m-%d") as enddate,count(m.id) as sn_sum,sum(m.real_price) as rmb_sum,sum(m.use_up) as use_up_sum,o.sn as machine_sn')
    ->join('__MACHINE__ o ON m.machine_id=o.id', 'LEFT')
    ->where($where)
    ->group('m.machine_id,FROM_UNIXTIME(m.enddate,"%Y-%m-%d")')
    ->order('m.enddate DESC')
    ->buildSql();
    $count = $orderModel->table($subQuery . ' a')->count();
    ————————————————
    版权声明:本文为CSDN博主「上善若水、」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/weixin_45623066/article/details/101372035

  • 相关阅读:
    1009 Product of Polynomials (25分)
    VS code 调试C++
    1065 A+B and C (64bit) (20分)
    UML与数据库应用系统
    语句(switch,异常,NDEBUG,assert)
    1046 Shortest Distance (20分)
    1042 Shuffling Machine (20分)
    模块和包
    闭包&装饰器
    迭代器、生成器
  • 原文地址:https://www.cnblogs.com/apolloren/p/12252381.html
Copyright © 2011-2022 走看看