With mysql 4.1.11, is there a way to compile the averages and standard deviations across multiple fields?
Field1 Field2 Field3
Want to be able to create a new column:
SELECT t.Field1, t.Field2, t.Field3, mean(Field1, Field2, Field3) as CalcMean
FROM mytable as t;
There are GREATEST and LEAST functions for taking the maximum and minimum, but no analog for average and standard deviation that I can find. It appears I would need to write a custom function. Also, would appear to be a fairly obvious extention.
Thanks
David Ziger
2 8397
Full support for SQL GROUP BY and ORDER BY clauses. Support for group functions (COUNT(), COUNT(DISTINCT ...), AVG(), STD(), SUM(), MAX(), MIN(), and GROUP_CONCAT()).
This is statement from the MySQL documentation see chapter The Main Features of MySQL from the "MySQL 3.23, 4.0, 4.1 Reference Manual".
Ronald :cool:
Thanks for looking at my message, but I don't think you understood the question unless I missed something in the manuals. I want to take the average or the mean of fields, row by row. Mysql has the GREATEST and LEAST functions to take max/min, row by row. But I don't see an analog for average or standard deviation. See for example:
mysql> select LEAST(LOC_ERROR_Y1,LOC_ERROR_Y2) as least_loc_error from z_all_GID3_pb_space_pw_priority LIMIT 2;
+-----------------+
| least_loc_error |
+-----------------+
| 228352 |
| 233194 |
+-----------------+
2 rows in set (0.02 sec)
mysql> select AVG(LOC_ERROR_Y1,LOC_ERROR_Y2) as avg_loc_error from z_all_GID3_pb_space_pw_priority LIMIT 2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LOC_ERROR_Y2) as least_loc_error from z_all_GID3_pb_space_pw_priority LIMIT 2' at line 1
Thanks,
David Ziger
Synopsys Inc
Sign in to post your reply or Sign up for a free account.
Similar topics
by: CSDunn |
last post by:
Hello,
I have 14 fields on a report that hold integer values. The field names
use the following naming convention: T1Number, T2Number ....T14Number.
I need to get a 'sub total' of all fields as...
|
by: Tony Lennard |
last post by:
I have several queries, which generate about 10 fields each a text
field of length 2 (which contain effort and attainment grades), eg A2,
B4, A3, A3. I am trying to calculate an 11th fields, which...
|
by: edhead |
last post by:
Access newbie here, I am trying to figure out how to set up a query
that will return an average from multiple records all created on the
same date. Table has the following fields date, weight1,...
|
by: amit |
last post by:
Hi guys
I am using access database with Crystal Reports in VS2003
I am working on "Hospital Database"
The fields are -
Name - Date - ConsultingCharge - TotalFees
i.e. Total Fees include fees...
|
by: chrisale |
last post by:
Hi All,
I've been racking my brain trying to figure out some sort of Sub-Select
mySQL statement that will create a result with multiple rows of
averaged values over a years time.
What I have...
|
by: abouddan |
last post by:
Hi all
I am working on an accounting project using MS Access 2000, that demands to calculate many fields in a spesific record.
The problem:
The query I am using returns many records and for each...
|
by: jl2886 |
last post by:
I have four fields in my table that I want to average providing the fields have a value, not the null, for each case(id). I also have an average field in my table. I have a form for the table and I...
|
by: wetsprockets |
last post by:
Hello,
I have two tables, WindVector (wind data) and DOH_FC88to07 (water quality samples). The WindVector table has the following fields:
Date (short date)
Time (short time)
WindSpeed...
|
by: ReneHernandez |
last post by:
Good afternoon,
I am trying to calculate an average over multiple fields. I've tried using the following
=Avg(IIF( = "NA",Null, Val())) + Avg(IIF( = "NA",Null, Val())) + Avg(IIF( = "NA",Null,...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |