| Author |
how to use triggers on mysql - query produce error
|
Peter Primrose
Ranch Hand
Joined: Sep 10, 2004
Posts: 755
|
|
Hi there, Can anyone advise why this sql statement is incorrect? I'm trying to learn how to use triggers on mysql I get: 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 car_id='6723' ) THEN UPDATE cars set car_n * using mysql version: 5.0.45-community-nt
|
 |
Paul Campbell
Ranch Hand
Joined: Oct 06, 2007
Posts: 338
|
|
I have no idea why you'd want to use a trigger for something this specific... but something more like this: CREATE TRIGGER T1 AFTER UPDATE ON cars FOR EACH ROW BEGIN IF (fax_number='555555' and car_id='6723') THEN set car_name = 'test'; END IF; END; If the columns you are testing for are being updated... you will new to use NEW/OLD depending on your test state.
|
 |
 |
|
|
subject: how to use triggers on mysql - query produce error
|
|
|