thinkphp下groupbyグループ化後、各グループの最新データを取得

518 ワード

$lock = M('locked_record');

$type = 1;

$subQuery = $lock->table('sys_locked_record')
->where(array('type'=>$type))
->order('addtime desc')
->buildSql();
		
$res = $lock->table($subQuery.'a')->group('uid')->select();