All pastes #396301 Raw Edit

Anonymous

public sql v1 · immutable
·published 2007-03-15 17:32 UTC
rendered paste body
DROP TABLE IF EXISTS `tm_user_wished`;CREATE TABLE `tm_user_wished` (  `id_user` int(10) NOT NULL default '0',  `id_tm` int(6) NOT NULL default '0',  `i_date` int(10) NOT NULL default '0',  UNIQUE KEY `users_wished_tms` USING BTREE (`id_user`,`id_tm`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;-- Table createdINSERT INTO tm_user_wished SET id_user=1,id_tm=11 ON DUPLICATE KEY UPDATE i_date=1;INSERT INTO tm_user_wished SET id_user=1,id_tm=11 ON DUPLICATE KEY UPDATE i_date=2;SELECT * FROM tm_user_wished;-- You can see that i_date is update as expected-- However, following inserts aren't duplicates of unique id_user/id_tm index, -- but it updating the previous record instead of adding new ones as expetedINSERT INTO tm_user_wished SET id_user=1,id_tm=22 ON DUPLICATE KEY UPDATE i_date=1;INSERT INTO tm_user_wished SET id_user=2,id_tm=11 ON DUPLICATE KEY UPDATE i_date=2;SELECT * FROM tm_user_wished;