I think that http://www.mysql.com/doc/en/example-Maximum-column-group-row.html covers your problem here.
You either have to solve it with Temporary tables, the MAX-Concat trick (in the url above) or a subquery (which will be more inefficient than the other two options). On Thu, 20 Nov 2003, Yves Goergen wrote: > Hi again... > yet another question to this list that maybe someone can easily answer me... > > When I do a GROUP BY on a column of my query, I'll get one random row from > the entire group. But how can I tell MySQL to, i.e., give me the row with > the highest value of another column or so? I mean something like > > SELECT id, grp FROM tbl GROUP BY grp ORDER BY id > > but with the ORDER BY relating to the GROUP... I don't know how to express > this in SQL since it doesn't seem to be possible? > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]