[DB-SIG] Strange resultset with ORDER BY col1, GROUP BY col2

Chris Cogdon chris at cogdon.org
Fri Jun 24 08:19:17 CEST 2005


On Jun 23, 2005, at 9:39 PM, Kolbe Kegel wrote:

> Again, I am using MySQL 5.0.7. I am using Python 2.4.2. I am using
> MySQLdb 1.1.6-1ubuntu2 (installed through apt on Ubuntu Linux 5.04).

I just tried something similar. I don't have the same versions as  
you, so I couldn't even use group_contact. I just created a column I  
could sum() instead.

The table looks like this:

+---------+----+------+
| comment | gr | x    |
+---------+----+------+
| hello   |  1 |    1 |
| there   |  1 |    2 |
| thingy  |  1 |    3 |
| foo     |  2 |    4 |
| boo     |  2 |    5 |
| baz     |  2 |    6 |
+---------+----+------+

The query was "select sum(x) as blah from gctest group by gr order by  
blah"

And all rows returned through MySQLdb were:

((6.0,), (15.0,))

Which is exactly what I was expecting (except the numbers being  
floats... that's annoying)

So... no repro here. But it could be a version thing:

Mysql: 3.23.40
Python: 2.2.2
MySQLdb: 0.9.2.final.1

(No picking on my versions... its the only system I had that had  
MySQL and MySQLdb installed :)

-- 
    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL



More information about the DB-SIG mailing list