INSERT wwwip SELECT data_id as id,data_ip as ip,count() as count from ip group by data_ip,data_id order by data_ip desc ,count() desc;