繁体   English   中英

错误1064:在mysql工作台中更新带有列和数字的表

[英]error 1064: Update a table with a column and a number in mysql workbench

我需要用2update一个表,其中一个是另一个表的列,第二个是数字( constant 1 ),这是我的代码:

insert into table (col1, col2)
select colA from table2, '1' 
 where DATA_FORMAT(table2.created_at, '%y %m %d') = DATA_FORMAT(Now(), '%y %m %d');

错误消息是:

Error Code: 1064. 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 ''0', '1', '1'  where DATA_FORMAT(newsletter.created_at, '%y %m %d') = DATA_FORMA' at line 2

尝试这个:

insert into table (col1, col2)
select colA, '1' as ColB from table2
where DATE_FORMAT(table2.created_at, '%y %m %d') = DATE_FORMAT(Now(), '%y %m %d');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM