shell - Update query wrong in MySQL
問題描述
各位大俠, 請問哪錯了?
Select * from rc where business_date = ’2017-03-21 16:50:29.032’. IFcutoff_dt` is null or empty, it will update, otherwise display notnull
#!/bin/bash mysql -u root -pPassword <<rc use rc; SELECT *, CASE WHEN cutoff_dt IS NULL THEN UPDATE rc SET cutoff_dt = ’2017-03-21 00:00:00.0’ ELSE ’NOT NULL’ END from rc WHERE business_date = ’2017-03-21 16:50:29.032’; rc
錯誤
ERROR 1064 (42000) at line 2: 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 ’UPDATE rc SET cutoff_dt = ’2017-03-21 00:00:00.0’ ELSE ’ at line 5
問題解答
回答1:據我所知,then后面跟的應該是個result,不知道是不是這么回事
相關文章:
1. python - 請問這兩個地方是為什么呢?2. mysql - 數據庫建字段,默認值空和empty string有什么區別 1103. node.js - mysql如何通過knex查詢今天和七天內的匯總數據4. javascript - 按鈕鏈接到另一個網址 怎么通過百度統計計算按鈕的點擊數量5. sql語句 - 如何在mysql中批量添加用戶?6. 怎么php怎么通過數組顯示sql查詢結果呢,查詢結果有多條,如圖。7. mysql建表報錯,查手冊看不懂,求解?8. mysql - JAVA怎么實現一個DAO同時實現查詢兩個實體類的結果集9. mysql - PHP定時通知、按時發布怎么做?10. 事務 - mysql共享鎖lock in share mode的實際使用場景
