$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();
原文地址:https://www.cnblogs.com/wangyuyanhello/p/8434764.html
时间: 2024-11-09 06:27:53