Hello,
I want to prevent duplicate entries in my table, so I am using INSERT IGNORE, but it is not working. I do have a PRIMARY KEY, whic is the table id. I have set 3 fields to be unique. Is there something else I am missing in order to make it work?
Thank in advance,
Wilfredo Mira
Using INSERT IGNORE
Re: Using INSERT IGNORE
According to the MySQL reference:
So, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table won't be inserted.If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued.
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.