Re: Appending one MySQL file to another without duplicates.
| From: | Ferenc Kovacs | Date: | Mon, 10 May 2010 07:04:00 +0000 |
| Subject: | Re: Appending one MySQL file to another without duplicates. | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30081@lists.php.net to get a copy of this message | ||
On Mon, May 10, 2010 at 8:03 AM, Niel Archer <not@chance.now> wrote:
> Hi
>
> As this is not a PHP question and in particular not Windows' related
> PHP question, I'll keep my reply brief.
>
> If you had a unique index defined, duplicates wouldn't be allowed. Then
> you would only have to add IGNORE to the INSERT to prevent warnings
> being generated.
> http://dev.mysql.com/doc/refman/5.1/en/insert.html
>
>
I would suggest INSERT ... ON DUPLICATE UPDATE field = field instead of
IGNORE(because IGNORE can suppress other errors), but you are right about
that the unique constraint.
Tyrael