时间: 2020-07-7|tag:84次围观|0 条评论

$res = M('member')
->table('__MEMBER__ as a')
->join('__ORDER__ as b')
->field('a.id,b.order_sn,count(b.id) as total')
->where('b.receive_member_id = a.id')
->group('a.id')
->order('total desc')
->limit($page->firstRow, $page->listRows)
->select();

表member和表order联合查询

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《thinkphp 3.2 多表联合查询 group分组
   

还没有人抢沙发呢~