MySQL Forums
Forum List  »  Spanish

Re: calcular el total de una columna al insertar
Posted by: Wolfgang Moriske
Date: December 16, 2019 04:04AM

Hola Fausto!

Quizás puedas resolverlo con un "Trigger"

Insert:

CREATE TRIGGER before_cust_order_insert
BEFORE INSERT ON cust_order
FOR EACH ROW
SET new.total = new.cant * new.precio


Update:

CREATE TRIGGER before_cust_order_update
BEFORE UPDATE ON cust_order
FOR EACH ROW
SET new.total = new.cant * new.precio

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: calcular el total de una columna al insertar
487
December 16, 2019 04:04AM


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.