I have table MYsql table.
name, t1 , t2 , t3.
there many names, and their scores.
Show would calculate the standard deviation of t1,t2,t3
Tried Select name, stddev(t1,t2,t3), it didnt work.
This works:
SELECT
NAME, STDDEV_SAMP(t) STD
FROM
( SELECT NAME, t1 AS t FROM test._copy
UNION ALL
SELECT NAME, t2 AS t FROM test._copy
UNION ALL
SELECT NAME, t3 AS t FROM test._copy
) t
GROUP BY NAME
STDEV() is an aggregation function. It takes values from many rows and yields a single result.
Unfortunately, it doesn’t take values from several fields. Just several rows, to do that you need to re-work your data to have all the values in a single column…
EDIT
Another option, instead of
UNION ALLcould be…