0

I am trying to create a trigger that updates one field in a table different from the one being updated/inserted.

My create trigger code looks like this:

CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw` 
FOR EACH ROW SET products.count - products.count +1;

When I try to create this I get an error #1193 - Unknown system variable 'count' but there is definately a field called 'count' in the product table.

What am I missing here?

Thanks!

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by ppetree
0

You have a - where there should be an =.

CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw`
      FOR EACH ROW SET products.count = products.count +1;
0

You have a - where there should be an =.

CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw`
      FOR EACH ROW SET products.count = products.count +1;

Yeah, that was a definate typo on my part but it didnt change the error message... I would have thought this would be a simple one.

I hate to use the mysql forums but I may have to on this one... dangit!

0
CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw` 
FOR EACH ROW SET products.count - products.count +1;
DELIMITER //

CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw` 
FOR EACH ROW 
BEGIN
UPDATE ddsw SET products.count - products.count +1; 
END //

DELIMITER ;
0

Ah, that makes sense. Glad you solved it!

Yeah, that one was really bugging me... it was primarily that update command... I guess you gotta select the table in which you want to set a field! LOL

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.