簡體   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