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 - 在 model里定義的 引用表模型時,model為undefined。2. python3.x - c++調用python33. css3 - 沒明白盒子的height隨width的變化這段css是怎樣實現的?4. atom開始輸入!然后按tab只有空格出現沒有html格式出現5. css3 - 這個右下角折角用css怎么畫出來?6. javascript - 一個關于客戶端和前端通信的疑惑?7. mysql cant connect to mysql server 3306 偶爾出現這個是什么原因呢8. debian - docker依賴的aufs-tools源碼哪里可以找到啊?9. java - 根據月份查詢多個表里的內容怎么實現好?10. android - 課程表點擊后浮動后邊透明可以左右滑動的界面是什么?
