找到你要的答案

Q:MYSQL update, subquery, where

Q:MySQL的更新,查询,在那里

I have little problem with a SQL statement in Axon Ivy.

UPDATE intra_gesuch
SET status = in.gesuch.status, 
    fk_sachbearbeiterin = (SELECT id_sachbearbeiterin 
                           FROM intra_sachbearbeiterin 
                           WHERE in.gesuch.sachbearbeiter.kuerzel = kuerzel);
WHERE casenumber = in.gesuch.casenumber;

but I get en error:

MySQLSyntaxErrorException:
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

'WHERE casenumber = 'b4133a49fd94'
    SET status = 'Überprüfung Anforderungen', fk' at line 2
    Failed to execute database query.
  Original Query: UPDATE intra_gesuch WHERE casenumber = in.gesuch.casenumber SET status = in.gesuch.status, fk_sachbearbeiterin =  (SELECT id_sachbearbeiterin     FROM intra_sachbearbeiterin     WHERE in.gesuch.sachbearbeiter.kuerzel = kuerzel)
  Expanded Query: UPDATE intra_gesuch
WHERE casenumber = 'b4133a49fd94'
SET status = 'Überprüfung Anforderungen', fk_sachbearbeiterin =
    (SELECT id_sachbearbeiterin 
    FROM intra_sachbearbeiterin 
    WHERE 'thsc' = kuerzel)

Could anyone help me with that problem? Thank you.

我在轴突常春藤SQL语句有点问题。

UPDATE intra_gesuch
SET status = in.gesuch.status, 
    fk_sachbearbeiterin = (SELECT id_sachbearbeiterin 
                           FROM intra_sachbearbeiterin 
                           WHERE in.gesuch.sachbearbeiter.kuerzel = kuerzel);
WHERE casenumber = in.gesuch.casenumber;

但我得到错误:

MySQLSyntaxErrorException:
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

'WHERE casenumber = 'b4133a49fd94'
    SET status = 'Überprüfung Anforderungen', fk' at line 2
    Failed to execute database query.
  Original Query: UPDATE intra_gesuch WHERE casenumber = in.gesuch.casenumber SET status = in.gesuch.status, fk_sachbearbeiterin =  (SELECT id_sachbearbeiterin     FROM intra_sachbearbeiterin     WHERE in.gesuch.sachbearbeiter.kuerzel = kuerzel)
  Expanded Query: UPDATE intra_gesuch
WHERE casenumber = 'b4133a49fd94'
SET status = 'Überprüfung Anforderungen', fk_sachbearbeiterin =
    (SELECT id_sachbearbeiterin 
    FROM intra_sachbearbeiterin 
    WHERE 'thsc' = kuerzel)

有谁能帮我解决这个问题吗?谢谢您.

mysql  sql