Hi! On Jul 13, Alexander Newald wrote: > Hello, > > I have a table with id (char(8)) and value (int(8)) > > To make my problem clear: > > There is no set with id = "20030713" > insert into table values ("20030713","10"); > > The next set is ("20030713","20") but as a set with 20030713 is > already available I like to have > update table set value = value + 20 where id = "20030713" > > I tried the "replace" command but I fail to get the "value = value + 20" working.
In 4.1 there is INSERT ... UPDATE command: INSERT INTO TABLE VALUES ("20030713","20") ON DUPLICATE KEY UPDATE VALUE = VALUE + 20 assuming, of course, there is a UNIQUE (or PRIMARY) key on ID, so that there will be "duplicate key" Regards, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer /_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]