zoukankan      html  css  js  c++  java
  • TP SQL统计查询语法

    获取今日订单总数和订单总金额

     //fields区分出order_type不等于1的订单,订单金额money加运费order_freight合计
     $fields = [
         'COUNT(1) as order_num',
         'SUM(IF(order_type != 1, money + order_freight, 0)) as order_price'
     ];
     //where区分统计今日订单,已付款pay_status状态
     $where = [
         [
             'create_time',
             'between',
             strtotime(date('Y-m-d')).','.strtotime(date('Y-m-d 23:59:59')),
         ],
         [
             'pay_status','=',1,
         ]
     ];
     $static = $this->field($field)->where($where)->where('is_deleted', 0)->find();
     return $static ? $static->toArray() : [];
  • 相关阅读:
    Vue自定义指令 directive
    Vue过滤器 filters
    贪心
    家庭作业
    线段
    数列极差
    shell
    智力大冲浪
    加工生产调度
    喷水装置
  • 原文地址:https://www.cnblogs.com/camg/p/12198145.html
Copyright © 2011-2022 走看看