我不能爲我的生活找出這裏發生了什麼。我期望在以下查詢中更新表entities
中的記錄5394560的rand_id
以更新以匹配表unique_ids
中相同記錄的rand_id
。相反,它會更新到9?!?!?奇怪的結果使用UPDATE查詢
mysql> update entities, unique_ids SET entities.rand_id = unique_ids.rand_id where entities.id=5394560;
Query OK, 1 rows affected (2.74 sec)
Rows matched: 1 Changed: 1 Warnings: 0
檢查結果:
mysql> select * from entities where id=5394560;
+---------+------------------+---------+---------------------+
| id | name | rand_id | created_at |
+---------+------------------+---------+---------------------+
| 5394560 | Andorra la Vella | 9 | 2013-03-15 13:58:38 |
+---------+------------------+---------+---------------------+
1 row in set (0.00 sec)
mysql> select * from unique_ids where id=5394560;
+---------+----------+
| id | rand_id |
+---------+----------+
| 5394560 | 26543652 |
+---------+----------+
1 row in set (0.00 sec)
我失去的東西完全簡單和愚蠢嗎?!?!?兩個表中的兩列都使用了int(11)
,所以我不認爲這是數據類型最大值的問題,但我可能是錯的...
我想這是在主鍵uniques_ids – rene 2013-03-15 12:25:05