纵有疾风起
人生不言弃

thinkphp 3.2 多表联合查询 group分组

$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分组
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录