MySQL Forums
Forum List  »  Triggers

how to update a record
Posted by: sam sam
Date: February 08, 2013 05:50AM

Hi when I executed an update statement to update a single record, my trigger update all records with the values of this record.

Here is my trigger:

DELIMITER $$
CREATE TRIGGER UPDATE_PRODUCT_ARTICLE_TRIGGER
AFTER UPDATE ON product_article
FOR EACH ROW BEGIN
update myisam_product_article
SET
product_id = NEW.product_id
AND a_desc = NEW.a_desc
AND header = NEW.header
AND parent_category_name = NEW.parent_category_name
AND sub_category_name = NEW.sub_category_name
AND postcode = NEW.postcode
AND latitude = NEW.latitude
AND longitude = NEW.longitude
AND creation_date = NEW.creation_date
AND suburb = NEW.suburb
AND state = NEW.state
WHERE article_id = NEW.article_id;
END$$
DELIMITER ;

update sql statement used:

update product_article set suburb="BLACKTOWN" where postcode="2148";

How to change my trigger for this case?

Thanks
Sam

Options: ReplyQuote


Subject
Views
Written By
Posted
how to update a record
3046
February 08, 2013 05:50AM
1180
February 09, 2013 01:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.