我有以下表格:
mysql> describe clubes;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ClubNum | int(11) | YES | | NULL | |
| Club | varchar(100) | YES | | NULL | |
| Fundación | date | YES | | NULL | |
| Provincia | varchar(50) | YES | | NULL | |
| Ciudad | varchar(100) | YES | | NULL | |
| Ganados | tinyint(100) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
mysql> describe invictos;
+----------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+--------------+------+-----+---------+-------+
| ClubId | int(11) | YES | | NULL | |
| Club | varchar(100) | YES | | NULL | |
| Campeonatos Invictos | tinyint(100) | YES | | NULL | |
+----------------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
我想要运行如下内容:
UPDATE invictos SET ClubId = ( SELECT ClubNum FROM clubes WHERE Club = "San Lorenzo") WHERE invictos.Club = "Chacarita Juniors";
但什么也没做,但如果我删除了' WHERE invictos.Club =" Chacarita Juniors"'部分更新每一行,为什么它不起作用?
请记住clubes.ClubNum = invictos.ClubId
我该怎么做?
提前致谢!