| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Jasper Bryant-Greene | Date: | August 18 2005 2:53am |
| Subject: | Re: INSERT record IF NOT EXISTS? | ||
| View as plain text | |||
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 nothing on duplicate key. :( Why not just make the key unique? Then the insert won't work if the value already exists for that key. Jasper
| Thread | ||
|---|---|---|
| • INSERT record IF NOT EXISTS? | Daevid Vincent | 18 Aug |
| • Re: INSERT record IF NOT EXISTS? | Jasper Bryant-Greene | 18 Aug |
| • Re: INSERT record IF NOT EXISTS? | Paul DuBois | 18 Aug |
| • Re: INSERT record IF NOT EXISTS? | Steve Edberg | 18 Aug |
