MySQL Forums
Forum List  »  Triggers

A little help with my trigger syntax
Posted by: Kurt Schell
Date: November 02, 2005 06:15PM

I can't seem to get this trigger to work.. I'm not sure what I'm doing wrong but I think my syntax is probably the problem.


drop trigger t_insert_customer_reviews;
delimiter //
create trigger
t_insert_customer_reviews
after insert on
customer_reviews
for each row
declare score double(4,1);
declare num_reviews int;

select avg(rating)*2 into score from customer_reviews where asin = new.ASIN;
select count(customer_id) into num_reviews from customer_reviews where asin = new.ASIN;

update
v_products
set
rating = score,
reviews = num_reviews
where
asin = NEW.asin;
//


Any ideas?

Thanks,

Kurt

Options: ReplyQuote


Subject
Views
Written By
Posted
A little help with my trigger syntax
3957
November 02, 2005 06:15PM
1915
November 02, 2005 10:46PM


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.