List:General Discussion« Previous MessageNext Message »
From:Aldrian Gintingsuka Date:September 16 1999 10:45am
Subject:Re: sum with group by in 3.23.3
View as plain text  
Hmmm, working fine in my case.

========================================================================
Aldrian Gintingsuka -- Systems Consultant -- Mitra Integrasi Informatika
Phone: +62-21-251-1360 ext. 1414 -- Fax: +62-21-251-2748
Email: aldrian@stripped, aldrian@stripped
------------------------------------------------------------------------
Si tu es contre Dieu, tu es contre l'homme (Enigma: Sadeness part I)



Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 105 to server version: 3.23.3-alpha

Type 'help' for help.

mysql> create table mytest (id char(1) not null, value int not null,
index(id), index(value));  
Query OK, 0 rows affected (0.11 sec)

mysql> insert into mytest values ('A', 1), ('B', 2), ('C', 3), ('A', 11),
('C', 33), ('C', 333);
Query OK, 6 rows affected (0.24 sec)
Records: 6  Duplicates: 0  Warnings: 0

mysql> select * from mytest order by id, value;
+----+-------+
| id | value |
+----+-------+
| A  |     1 |
| A  |    11 |
| B  |     2 |
| C  |     3 |
| C  |    33 |
| C  |   333 |
+----+-------+
6 rows in set (0.19 sec)

mysql> select sum(value) from mytest;
+------------+
| sum(value) |
+------------+
|        383 |
+------------+
1 row in set (0.09 sec)

mysql> select id, sum(value) from mytest group by id;
+----+------------+
| id | sum(value) |
+----+------------+
| A  |         12 |
| B  |          2 |
| C  |        369 |
+----+------------+
3 rows in set (0.09 sec)

mysql> 



On Thu, 16 Sep 1999 luuk@stripped wrote:

luuk> >Am I just stupid, or does sum() with a group by still not work
luuk> in 3.23.3. =
luuk> >(The eratta says it's been fixed).
luuk> >
luuk> >A query like this works:
luuk> >
luuk> >select sum(tot) from mytable;
luuk> >
luuk> >This does not work:
luuk> >
luuk> >select otherfield, sum(tot) from mytable group by otherfield;
luuk> >
luuk> >The sum field is allways 0.
luuk> >
luuk> 
luuk> I just wanted to send the same message to the mailinglist. I
luuk> have the same problem here. The sum bug isn't fixed in version
luuk> .3.
luuk> 



Thread
sum with group by in 3.23.3Richard Ellerbrock16 Sep
Re: sum with group by in 3.23.3luuk16 Sep
  • Re: sum with group by in 3.23.3Aldrian Gintingsuka16 Sep
  • Re: sum with group by in 3.23.3Michael Widenius17 Sep