Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Steve Edberg
At 7:10 PM -0700 8/17/05, Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close,

Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Paul DuBois
At 19:10 -0700 8/17/05, Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? Isn't that how INSERT works already? If what you mean is that you want no error to occur, perhaps you want to use INSERT IGNORE instead. http://de

Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Jasper Bryant-Greene
Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close, but I want it to do nothin

INSERT record IF NOT EXISTS?

2005-08-17 Thread Daevid Vincent
Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close, but I want it to do nothing on duplicate key. :(