好吧,我难倒就这一个:MySQL的INSERT INTO未能在WHERE子句
mysql> INSERT INTO item (col1) VALUES ('testing') WHERE item_name = 'server1';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE item_name = 'server1'' at line 1
这里的表递减(略消毒):
mysql> desc item;
+--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| item_name | varchar(128) | YES | | | |
| active | int(11) | NO | | 0 | |
| col1 | varchar(512) | YES | | NULL | |
+--------------+--------------+------+-----+---------+----------------+
]我已经尝试了一些变化在INSERT上,但我无处可去。期待有人透露我失踪的任何明显的事情!
运行:mysql Ver 14.12 Distrib 5.0.95,用于redhat-linux-gnu(x86_64),使用readline 5.1(我知道它比较老,但我现在不能升级这个盒子)。
希望这个答案会有所帮助:http://stackoverflow.com/a/485062/2451726 – Arulkumar
INSERT INTO不支持WHERE 这个http://stackoverflow.com/questions/485039/mysql-insert-where-query将有所帮助。 – starplateena
而不是插入查询您使用更新查询在哪里条件 – Saty