Zi-yan Tseng Zi-yan Tseng - 5 months ago 17
SQL Question

MySQL trigger update syntax error

I wander to set a trigger after update , and if the number of

product.Quanity
less then 200 , it will be 200. And it's my code , how can i improve it?

The error message said that the error at line 4.



IF (SELECT product.Quanity<200)
THEN
UPDATE product
SET product.Quanity = 200




Using phpmyadmin - sql

Answer

Yo need use where for solve.

UPDATE product
SET product.Quanity = 200
WHERE product.Quanity < 200

:-D