Behavior of ON DUPLICATE KEY

2005-05-15 Thread Taisuke Yamada
Hi. I found behavior of "ON DUPLICATE KEY" bit odd, and would like to know if it's a bug or feature. I'm trying to "insert" or "add" (not "replace") data of one table to another table and came up with following statement: CREATE TABLE

Re: Behavior of ON DUPLICATE KEY

2005-05-15 Thread Sergei Golubchik
Hi! On May 15, Taisuke Yamada wrote: Hi. I found behavior of ON DUPLICATE KEY bit odd, and would like to know if it's a bug or feature. I'm trying to insert or add (not replace) data of one table to another table and came up with following statement: CREATE TABLE foo (id INT NOT NULL

Re: Behavior of ON DUPLICATE KEY

2005-05-15 Thread Taisuke Yamada
Thanks for the verification. After some experiments, I came up with an alternative using REPLACE INTO foo (...) SELECT ... UNION ... to accomplish the same task, so will use it for now. INSERT INTO foo (id, value) SELECT id, value FROM bar ON DUPLICATE KEY UPDATE value = value +