MySQL Forums
Forum List  »  Triggers

Re: Calculation from time stamps through to amount due
Posted by: Kailas Natha
Date: September 04, 2016 07:32PM

right... I had tried before with a semicolon between the two set clauses... using just a comma.. this compiles with no errors;

delimiter GO
drop trigger if exists calculate_time_rate;
CREATE trigger calculate_time_rate
BEFORE INSERT ON admin_time_tracker
FOR each
ROW
BEGIN
SET new.elapsed = ( TIMESTAMPDIFF( MINUTE , new.start_time, new.end_time ) / 60.00 ),
new.amount_due = ( new.elapsed * rate ) ;
END;
GO
delimiter

but when I try to in sert a new row I get this error now:

insert into HA_ADMIN Admin_time_tracker
id
developer
data
project
task
description
starttime
endtime
elapsed
rate
amount_du
doc_link
task_id
project_id

MySQL said

#1054 "unknown column 'rate' in 'field list'

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Calculation from time stamps through to amount due
1089
September 04, 2016 07:32PM


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.