主键重复时更新数据否则插入 ON DUPLICATE KEY UPDATE
INSERT INTO keyword_srch_CNT_TOP_100_MONTH_20130301190944(CGI,ACCESS,IP,REF,UA,HIT) VALUES
('getlogcollect.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','100')
,
('navisearchif7.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','200'),
('navisearchif7.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','200'),
('navisearchif7.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','200'),
('navisearchif7.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','200'),
('keywordmap.cgi','2013-03-01 00:00:00','172.26.176.95','','Firefox','2918') ON DUPLICATE KEY UPDATE ACCESS=ACCESS, datacnt=datacnt+1
遇到一个问题当表中有一个字段是日期类型时用 ON DUPLICATE KEY UPDATE 做更新的数据时日期会变掉,最后把
ON DUPLICATE KEY UPDATE ACCESS=ACCESS, datacnt=datacnt+1 加上解决了