I am creating a trigger on the table below,
CREATE TABLE test( id int auto_increment primary key,
name varchar(40),
debit decimal(19,2) default "0.00",
fee decimal(19,2) default "0.00",
balance decimal(19,2) default "0.00")
ENGINE=INNODB;
Below also is the trigger code.
CREATE TRIGGER update_test BEFORE INSERT ON test t FOR EACH ROW
(select debit from test d where d.id="1")
SET new.balance=30 + d.debit;
This trigger is suppose to update the test table(balance column) upon insertion into the test table.The trigger is suppose to select the debit value from the test table and add 30 before updating the balance column in the test table.But this query above wouldn't work.It keeps giving me this error
ERROR 1415 (0A000): Not allowed to return a result set from a trigger
Please I need help on how to figure what the problem is.Thanks in advance.
select debit from test dwill return more than one row, right?