eric.zl
eric.zl

Reputation: 1

MySql create trigger error 1064

the sql I wrote is as below:

create

trigger test_schedule_trigger after update on tw_task
as
update tw_test_schedule test, tw_task task
set test.name = task.name,test.`type`=task.`type`,test.is_deleted=task.is_deleted,test.gmt_modified=task.gmt_modified;
where tw_test_schedule.task_id = tw_task.id;

the error description is:

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 tw_test_schedule.task_id = tw_task.id' at line 1

Upvotes: 0

Views: 74

Answers (2)

paxdiablo
paxdiablo

Reputation: 881093

You have a ; semicolon at the end of your set line:

                                                right here
                                                     v
set blah, blah, test.gmt_modified = task.gmt_modified;
where blah ...

This is terminating the statement, meaning that the where is not really valid SQL. Just get rid of that semicolon.

Upvotes: 0

Mohamad Arafat
Mohamad Arafat

Reputation: 573

Try remove the ; before the WHERE

Upvotes: 1

Related Questions