Tp field 字段是可以添加函数的

$info = M('Order')->alias('a')
->field('count(DISTINCT(a.order_user_id)) as buy_user_num,count(*) as sum,sum(a.close_pay) as order_sum')
->join('__APP_TYPE_EDITION__ as b on b.type_id=a.type_id and b.edition_id=a.edition_id')
->join('__USER__ as c on c.user_id=a.order_user_id')
->where($where)
->order($order)
->find();
统计订单 的购买用户数,订单数,订单金额数

posted on 2016-10-25 17:21  studyphp  阅读(1262)  评论(0编辑  收藏  举报

导航