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

Chris Cogdon chris at cogdon.org
Fri Jun 24 17:14:00 CEST 2005


On Jun 24, 2005, at 4:19 AM, Andy Todd wrote:

> - Do you need to do the group_concat transposition in SQL or would  
> it be
> better achieved in Python after you've select all of the group,  
> comment
> pairs from the database?

If you're grouping a particular column, you MUST use some kind of  
aggregate function on that column (eg, sum, max, or the mysql  
specific group_concat).

The alternative is to retrieve N times more rows and do the grouping  
and concatenation in python, which is inefficient. What Kolbe trying  
to do should work just fine.

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



More information about the DB-SIG mailing list