使用以下查询,我无法弄清楚为什么我的更新无效。我确定它有点愚蠢,但是非常感谢任何帮助:
UPDATE Mail
SET From="Spouse"
WHERE ItemNum=9;
错误是:
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 'From="Spouse" WHERE ItemNum=9' at line 1
Mail的架构是:
CREATE TABLE `Mail` (
`ItemNum` int(11) NOT NULL auto_increment,
`Qtr` int(11) NOT NULL default '0',
`MsgDate` date default NULL,
`From` varchar(64) default NULL,
`Message` varchar(255) default NULL,
PRIMARY KEY (`ItemNum`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1
答案 0 :(得分:4)
From
是MySQL reserved keyword。用反引号围绕它:
UPDATE Mail
SET `From`="Spouse"
WHERE ItemNum=9;