MySQL Forums
Forum List  »  Triggers

Need help to create a calculating trigger
Posted by: Harald Bacik
Date: November 24, 2010 04:58AM

Hey
I need some help please.
I have two tables, which are related to gether.
In Table A I have the following fields: ID, Article, Price
In Table B I have the following fields: ID, TableAID, CompanyID, stock, stockPrice

So, now I want create a trigger, which calculates the "stockprice" field after updating a row. I tried the following trigger, but this doesn't work:


CREATE DEFINER = 'myName'@'%' TRIGGER lagerwert_invwert
AFTER UPDATE
ON artikelstammdetails
FOR EACH ROW
BEGIN
Update B Set
lagwert = new.Stock*
(Select Distinct Price From
A Where A.ID=
new.TableAID),
END

Please, can anyone help me to get this working! - THX

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help to create a calculating trigger
1984
November 24, 2010 04:58AM


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.