Saturday 15 February 2014

sql - AVG and STD in MySQL using field values of the same row -



sql - AVG and STD in MySQL using field values of the same row -

i know how utilize avg() , std() functions in mysql calculate averages or standard deviations query or query grouping by

select avg(amount) table select mykey,std(amount) table grouping key

my question is, can utilize functions when set of values in different columns of row?

mykey value1 value2 value3 value4 value5 myavg mystd 1 5.0 3.0 4.0 5.0 3.0

myavg average of value1,value2,value3,value4 , value5 (in illustration (5+3+4+5+3)/5 = 4) stdmykey standard deviation of value1,value2,value3,value4 , value5

some kind of...

update table set myavg = avg(value1,value2,value3,value4,value5), mystd = std(value1,value2,value3,value4,value5)

update table set myavg = (value1+value2+value3+value4+value5)/5, mystd = ...

mysql sql std average

No comments:

Post a Comment