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. 如何分別在Windows下用Winform項模板+C#,在MacOSX下用Cocos Application項目模板+Objective-C實現一個制作游戲的空的黑窗口?2. java - new + 類名,一定需要申明一個對象嗎?3. python - linux怎么在每天的凌晨2點執行一次這個log.py文件4. javascript - jQuery each 方法第三個參數args 如何解釋?5. javascript - js中遞歸與for循環同時發生的時候,代碼的執行順序是怎樣的?6. android - 鍵盤遮擋RecyclerView7. php如何獲取訪問者路由器的mac地址8. php - mysql 模糊搜索問題9. 小程序怎么加外鏈,語句怎么寫!求救新手,開文檔沒發現10. javascript - vue-resource中如何設置全局的timeout?
