Re: Update but insert if not exist

2007-12-17 Thread Rob Wultsch
On Dec 16, 2007 10:29 AM, Afan Pasalic [EMAIL PROTECTED] wrote: try REPLACE http://dev.mysql.com/doc/refman/5.1/en/replace.html -afan Replace will not do an update. All previous data will be lost. A mysql-centric alternative solution would be to use INSERT ... ON DUPLICATE KEY UPDATE

Re: Update but insert if not exist

2007-12-17 Thread J Trahair
This is a question I want to know the answer to, as well! Is there any way of avoiding looking up a specific record in a table to see if it exists, before deciding whether to INSERT INTO or UPDATE, eg: mstrSQL = SELECT * FROM Shops WHERE ShopReference = ' grd1.TextMatrix(numRowNo, 1) '

Re: Update but insert if not exist

2007-12-17 Thread Jay Pipes
INSERT ... ON DUPLICATE KEY UPDATE: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Cheers, Jay J Trahair wrote: This is a question I want to know the answer to, as well! Is there any way of avoiding looking up a specific record in a table to see if it exists, before

Update but insert if not exist

2007-12-16 Thread Steffan A. Cline
I am trying to think of a trick way to handle something. I have been successful in using the multiple inserts in one row by using the ,(xx,xx,xx),(xx,xx,xx),(xx,xx,xx) in a values block. BUT Is it possible to insert if not there for example Update if anyone not found then insert new

Re: Update but insert if not exist

2007-12-16 Thread Afan Pasalic
try REPLACE http://dev.mysql.com/doc/refman/5.1/en/replace.html -afan Steffan A. Cline wrote: I am trying to think of a trick way to handle something. I have been successful in using the multiple inserts in one row by using the ,(xx,xx,xx),(xx,xx,xx),(xx,xx,xx) in a values block. BUT Is it