찾다

 >  Q&A  >  본문

shell - Update query wrong in MySQL

各位大侠, 请问哪错了?

Select * from rc where business_date = '2017-03-21 16:50:29.032'. IF
cutoff_dt` is null or empty, it will update, otherwise display not
null

  #!/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
PHPzPHPz2783일 전651

모든 응답(1)나는 대답할 것이다

  • 高洛峰

    高洛峰2017-04-17 16:43:24

    내가 아는 한, 그 다음은 결과여야 하는데, 그럴지는 모르겠습니다

    회신하다
    0
  • 취소회신하다