'Mysql-how to assign value from a field of select into local variable?
I'm trying to assign a value from a field of a select statement to a local variable in my trigger. Does it have any way to do that? Any help would be very appreciated My trigger
DELIMITER $$
CREATE TRIGGER update_cart_total
before insert
ON core_cartdetails FOR EACH ROW
BEGIN
declare total DOUBLE;
select Total into total from core_cart where CartID = NEW.CartID;
END $$
DELIMITER ;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
