Automatic sum in mysql -


i have 3 fields in table num1, num2, num3.

i need average of these 3 in field avgnum.

user insert values of num1, num2, num3 using insertion query.

is possible make?

you can create trigger, this:

create trigger `new_table_before_insert` before insert on `new_table` each row set new.avgnum = (new.num1+new.num2+new.num3)/3 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -