Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:37:45+00:00 2026-05-25T15:37:45+00:00

I have table MYsql table. name, t1 , t2 , t3. there many names,

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:37:46+00:00Added an answer on May 25, 2026 at 3:37 pm

    STDEV() is an aggregation function. It takes values from many rows and yields a single result.

    SELECT
      name,
      STDEV(t1)   standard_deviation_of_t1,
      STDEV(t2)   standard_deviation_of_t2,
      STDEV(t3)   standard_deviation_of_t3
    FROM
      yourTable
    GROUP BY
      name
    
    -- This will give meaningful results if there are several records for the
    -- same name.
    

    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…

    SELECT
      name,
      STDEV(t)   standard_deviation_of_all_t_values,
    FROM
    (
      SELECT name, t1 AS t FROM yourTable
      UNION ALL
      SELECT name, t2 AS t FROM yourTable
      UNION ALL
      SELECT name, t3 as t FROM yourTable
    )
      AS data
    GROUP BY
      name
    

    EDIT

    Another option, instead of UNION ALL could be…

    SELECT
      name,
      STDEV(CASE map.field_id WHEN 1 THEN t1 WHEN 2 THEN t2 ELSE t3 END)
    FROM
      your_table
    CROSS JOIN
      (SELECT 1 as field_id UNION ALL SELECT 2 UNION ALL SELECT 3) AS map
    GROUP BY
      name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many rows in a mysql table. There is an order_id column. I
I have a table in mysql like this Name Result T1_09_03_2010 fail T2_09_03_2010 pass
I have a table in MySQL of contact information ; first name , last
i have a table in my mysql database named (names) now everyone can save
I have a MySQL table by name 'videos', where one of the column is
I have a table with symbol names (e.g. functions) and their start memory address
I have a table in Mysql (firstname,lastname,data1,data2,...) that one field name is MYDATE and
i have a table name preferences under this there are multiple columns but i
I have a MySQL table with many numeric columns (some INT, some FLOAT). I
I have a 2 MySQL tables like that: Table: WIFI_Spots ********************* ID | Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.