count被作为查询字段时

Posted 今年我二十有七

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了count被作为查询字段时相关的知识,希望对你有一定的参考价值。


$list = Db::name(‘shop_collection‘)
->alias(‘a‘)
->where($where)
->leftjoin(‘bojie_shop_goods b‘, ‘a.goods_id = b.id‘)
->leftjoin(‘bojie_shop_goods_class c‘, ‘a.class_id = c.id‘)
->leftjoin(‘bojie_shop_goods_order_pay d‘, ‘a.goods_id = d.goods_id‘)
->leftjoin(‘bojie_shop_list e‘, ‘b.shop_id = e.id‘)
->field(‘a.url, b.title, b.img, b.price, c.class_name, count(d.id) count, e.shop_name‘)
->group(‘a.id‘)//有group时被分组,没有时只能查询一条数据
->page($page[‘pageNum‘],$page[‘numPerPage‘])
->order(‘a.id‘, ‘desc‘)
->select();

以上是关于count被作为查询字段时的主要内容,如果未能解决你的问题,请参考以下文章

使用带数组的find_if()时代码段出错

使用具有不同片段字段的相同中继根查询的多个 react-router-relay 路由

如何重用graphql查询中的字段

从 S3 下载工件时代码构建访问被拒绝

Solr Highlighting:如何为同一字段请求多个片段长度?

在 GraphQL 中重用输入类型作为片段 [重复]