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. MySQL中無法修改字段名的疑問2. javascript - 關于emoji是如何解析的呢??3. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?4. 網頁爬蟲 - 用Python3的requests庫模擬登陸Bilibili總是提示驗證碼錯誤怎么辦?5. javascript - 微信小程序封裝定位問題(封裝異步并可能多次請求)6. android - QQ物聯,視頻通話7. 請教各位大佬,瀏覽器點 提交實例為什么沒有反應8. python的前景到底有大?如果不考慮數據挖掘,機器學習這塊?9. mysql - 怎么讓 SELECT 1+null 等于 110. Matlab和Python編程相似嗎,有兩種都學過的人可以說說嗎
