Have you look at replace ?
http://dev.mysql.com/doc/refman/5.0/en/replace.html
Carlos
Douglas Pearson wrote:
Apologies if this is a dumb question, but is it possible to write a single
query that either updates certain columns in a row, or adds an entirely new
row if there is none already?
I seem to be running into this a lot, and so far I've solved it by:
1) run UPDATE table SET x,y WHERE some row
2) if rowsChanged == 0 then run the INSERT
It just feels like there must be a way to do this more efficiently.
Thanks,
Doug
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]