mysql> desc tb_user_anonymous_history;
+----------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+-------+
| u | char(64) | NO | PRI | NULL | |
| day_index | int(10) unsigned | NO | PRI | 0 | |
| last_fight_day | int(10) unsigned | NO | | 0 | |
| fight_win | tinyint(3) unsigned | NO | | 0 | |
| fight_total | tinyint(3) unsigned | NO | | 0 | |
+----------------+---------------------+------+-----+---------+-------+
select u,sum(fight_total) as total from tb_user_anonymous_history where last_fight_day>=20120423 and last_fight_day <=20120424 group by u having total >= 12;
]]>