REPLACE query not working

admin

Administrator
Staff member
mysql> CREATE TEMPORARY TABLE srch_tmp SELECT * FROM individuals
-> WHERE state REGEXP "PA";
Query OK, 1 row affected (0.11 sec)
Records: 1 Duplicates: 0 Warnings: 0

mysql> SELECT individuals_ID, first, last FROM srch_tmp;
+----------------+-----------+---------+
| individuals_ID | first | last |
+----------------+-----------+---------+
| 1 | Daniel K. | Richter |
+----------------+-----------+---------+
1 row in set (0.01 sec)

mysql> REPLACE srch_tmp
-> SELECT * FROM individuals WHERE city REGEXP "Philadelphia";
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0

mysql> SELECT individuals_ID, first, last FROM srch_tmp;
+----------------+-----------+---------+
| individuals_ID | first | last |
+----------------+-----------+---------+
| 1 | Daniel K. | Richter |
| 1 | Daniel K. | Richter |
+----------------+-----------+---------+
2 rows in set (0.00 sec)

The "individuals_ID" field is primary key, index, unique. Can anyone point out why REPLACE isn't working as expected (i.e. updating the row in question)?

Thanks so much,

Reha
 
Back
Top