tp框架如何处理mysql先排序在分组

时间:2022-01-10 09:50:57

$giModel = M('GroupIntegral');
$gi_table = $giModel->order('id desc')->limit('999')->buildSql();//先排序
$gi_list = $giModel->table($gi_table .'as gi')
->field('gi.*,m.username,m.mobile')
->group('gi.uid')
->join('pre_members m on m.uid = gi.uid')
->select();//在关联分组