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. javascript - 請教空白文本節點的問題2. javascript - 百度echarts series數據更新問題3. javascript - 請問一下組件的生命周期beforeDestory是在什么情況下面觸發的呢?4. php - 第三方支付平臺在很短時間內多次異步通知,訂單多次確認收款5. Mysql && Redis 并發問題6. javascript - node服務端渲染的困惑7. css - 求推薦幾款好用的移動端頁面布局調試工具呢?8. mysql - 一個表和多個表是多對多的關系,該怎么設計9. python - type函數問題10. mysql新建字段時 timestamp NOT NULL DEFAULT ’0000-00-00 00:00:00’ 報錯
