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 - AttributeError: ’module’ object has no attribute ’MatchType’2. javascript - JS設置Video視頻對象的currentTime時出現了問題,IE,Edge,火狐,都可以設置,反而chrom卻...3. javascript - 圖片能在網站顯示,但控制臺仍舊報錯403 (Forbidden)4. MySQL客戶端吃掉了SQL注解?5. 網頁爬蟲 - python爬蟲翻頁問題,請問各位大神我這段代碼怎樣翻頁,還有價格要登陸后才能看到,應該怎么解決6. 數據庫 - MySQL 單表500W+數據,查詢超時,如何優化呢?7. objective-c - iOS怎么實現像QQ或者微信的實時推送8. php自學從哪里開始?9. 求大神幫我看看是哪里寫錯了 感謝細心解答10. phpstady在win10上運行
