0 ? $gameId : ['gt', 0]; $map['promote_id'] = ['in', [1,2]]; $map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1']; $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,game_id as pay_num'; $subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->select(false); $data = M('spend', 'tab_')->field('a.pay_time,count(DISTINCT a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select(); var_dump(M()->getLastSql());die(); return $data; } }