-- 电视剧导入，统计sql处理，保留最新数据
DELETE t1 FROM ad_theatre_tv_stat t1,
(
	select name,`media_name`,`theatre_time`,`show_date`,
	max(id) id FROM ad_theatre_tv_stat group by
	name,`media_name`,`theatre_time`,`show_date`
	having count(*) >1
) t2 WHERE t1.name = t2.name and
 t1.media_name = t2.media_name and t1.theatre_time = t2.theatre_time and t1.show_date = t2.show_date
 AND t1.id < t2.id



