MySQL Forums
Forum List  »  Triggers

Need help with a simple trigger
Posted by: Darren White
Date: January 20, 2012 05:06AM

I have a table with continually updated updated values. I want to log particular rows and columns to another table.

the following sql command and trigger gives this error:
update pgs.b04_reel_data set tension_potmeter="1" WHERE id=1;
Error code 1054. Unknown column 'id' in 'field list'

Hopefully I just need some help with syntax here...


-- Trigger DDL Statements
DELIMITER $$

USE `pgs`$$

CREATE TRIGGER `log01_after_update`
AFTER UPDATE ON `b04_reel_data` FOR EACH ROW
BEGIN
IF id="1" THEN
INSERT INTO log02_str_tension (str_reel_01) VALUES (NEW.tension_potmeter);
END IF;
IF id="2" THEN
INSERT INTO log02_str_tension (str_reel_02) VALUES (NEW.tension_potmeter);
END IF;
END;

$$

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help with a simple trigger
2645
January 20, 2012 05:06AM
1456
January 20, 2012 05:24AM
1215
January 20, 2012 05:45AM
1283
January 20, 2012 06:24AM
1322
January 27, 2012 01:38PM
1179
February 23, 2012 02:50PM
1167
February 23, 2012 08:05PM


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.