0

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

4
  • first of all, you need to tell us what database engine you are using Commented Jun 21, 2016 at 21:11
  • sorry , i 'd updated the question , and my engine is phpmyadmin-sql Commented Jun 21, 2016 at 21:14
  • 1
    that's not a database engine. Are you using MySQL?, SQL Server?, Oracle?, Postgresql? Commented Jun 21, 2016 at 21:15
  • If you're using PhpMyAdmin to work with your database, then you're working with MySQL - not (Microsoft) SQL Server ..... Commented Jun 21, 2016 at 21:47

1 Answer 1

2

Yo need use where for solve.

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

:-D

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.