Reputation: 777
Hey guys i was trying to convert my INSERT
query into an Update
query. But i have problems doing it. This is my Insert
query:
INSERT INTO lm_Artikel (Status)
SELECT 'NOK'
FROM lm_Artikel A
INNER JOIN lm_Schwellwert S ON A.Typ = S.Typ
WHERE A.Bestand < S.Schwellwert
And this is my attemp to convert it:
Update A SET A.Status = 'NOK'
FROM lm_Artikel A
INNER JOIN lm_Schwellwert S ON A.Typ = S.Typ
WHERE A.Bestand < S.Schwellwert
It is not working can anyone help me?
Upvotes: 2
Views: 105
Reputation: 263693
in MySQL, there is no FROM
keyword when joining a table. Your join syntax is correct but that's for T-SQL
Update lm_Artikel A
INNER JOIN lm_Schwellwert S
ON A.Typ = S.Typ
SET A.Status = 'NOK'
WHERE A.Bestand < S.Schwellwert
Upvotes: 4