List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 31 2002 4:34am
Subject:Re: replace ... select (why showing duplicates?)
View as plain text  
At 10:02 -0800 12/30/02, Qunfeng Dong wrote:
>Hi,
>
>When I do "replace table2 select (cols) table1 where
>clause" to update some records in the table2,
>sometimes I got the something like following
>indicating Duplicates records being detected.
>
>---------------------------------------------------
>Query OK, 122259 rows affected (1 min 18.28 sec)
>Records: 122259  Duplicates: 122254  Warnings: 0
>---------------------------------------------------
>
>Can I safely ignore such "warnings"? The thing bothers
>me is that the records selected from the table1 are
>NOT duplicate with the existing records in the table2,
>but still showing the "Duplicates"? They are NOT
>duplicate because the count(*) with the whereclause
>returns 0 records before the above "replace ...
>select"
>mysql> select count(*) from table2 where clause;
>+----------+
>| count(*) |
>+----------+
>|        0 |
>+----------+

That's not a valid test of your assertion.  A "Duplicate" will occur
if the set of records added in the REPLACE statement contains two records
with the same unique key value.  The duplicate will be that the second
of thesee records kicks out the first one.

>
>
>I am using mysql3.23.49 Linux redhat7.3
>
>Thanks!
>
>Qunfeng Dong

Thread
replace ... select (why showing duplicates?)Qunfeng Dong30 Dec
  • Re: replace ... select (why showing duplicates?)Paul DuBois31 Dec