我一生都无法弄清楚这里发生了什么。我希望在以下查询中更新rand_id
table 中的记录 5394560entities
以匹配rand_id
table 中相同记录的unique_ids
。相反,它会更新到 9?!?!?
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)
,所以我认为数据类型的最大值不是问题,但我可能是错的......