Hi.

On Tue 2002-07-09 at 10:49:51 +0200, [EMAIL PROTECTED] wrote:
> Hi all again,
> 
> I've been experimenting and would like to know if there is a known bug in
> the std function when used with a group by clause?
> I'd like to know if others have found this problem or is it just me:
> 
> I have a query without a groupby clause and the avg and std functions work
> fine.
> I add a group by clause on a field brought in from another table and the avg
> still works as expected but the std function returns all 0's.

Works fine for me:

mysql> SELECT VERSION();
+-------------+
| VERSION()   |
+-------------+
| 3.23.49-log |
+-------------+
1 row in set (0.00 sec)

mysql> SELECT AVG(next_number), STD(next_number), RIGHT(gid,1) AS num
       FROM guestbook GROUP BY num;
+------------------+------------------+-----+
| AVG(next_number) | STD(next_number) | num |
+------------------+------------------+-----+
|          51.3246 |         425.2162 | 0   |
|          52.2017 |         462.1029 | 1   |
|          49.1940 |         583.3506 | 2   |
|          48.7603 |         456.9280 | 3   |
|          47.1003 |         320.1228 | 4   |
|          48.7468 |         335.8219 | 5   |
|          50.0569 |         492.2443 | 6   |
|          48.5563 |         342.7715 | 7   |
|          49.7978 |         453.4491 | 8   |
|          54.5569 |         982.1618 | 9   |
+------------------+------------------+-----+
10 rows in set (2.32 sec)

Please try to provide a full test case which shows the problem.

> this does NOT:
> select count(Test1000.OID) as N,Language,
> avg(Accuracy) as AccAvg,std(Accuracy) as AccStd
> from Test1000,ROrders
> WHERE ROrders.OID=Test1000.OID
> Group by Language
> ----------------------------
> N     Language AccAvg AccStd
> 521     1       91.4302     0.0000
> 24     2         87.3846     0.0000
> 
> Any thoughts or referals would be greatly appreciated!
[...]

Greetings,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to