MySQL Forums
Forum List  »  Triggers

Calculation from time stamps through to amount due
Posted by: Brahmanatha Swami
Date: September 02, 2016 07:35PM

I have three fixed data columns in a table used to log developer time and payment due

start_time end_time

I have this trigger which works:

set new.elapsed=(TIMESTAMPDIFF(MINUTE , new.start_time , new.end_time ) / 60.00);
# the total time will be entered into the column "elapsed"
# now I want to multiply the rate e.g. $40.00 per hour by the elapsed time
# to get the amount do for each row.
# but the following throws and error.

set new.elapsed=(TIMESTAMPDIFF(MINUTE , new.start_time , new.end_time ) / 60.00;
set new.amount_due=(elapsed * rate)

What am I doing wrong?

Options: ReplyQuote


Subject
Views
Written By
Posted
Calculation from time stamps through to amount due
945
September 02, 2016 07:35PM


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.