List:General Discussion« Previous MessageNext Message »
From:Perrin Harkins Date:June 21 2008 3:45pm
Subject:Re: Error with max and group by
View as plain text  
On Sat, Jun 21, 2008 at 8:34 AM, Joe Pearl <joe@stripped> wrote:
> Thanks, but this is not the result I want.

I really think it is.  You seem to be misunderstanding how GROUP BY
works.  In any other database than MySQL, the SQL you wrote would
simply give an error.  In MySQL, it gives you random results for all
but the grouped column.  The example I pointed to will give you the
values from the row with the MAX date for each person.

Actually, this example is more complete for you, since it gets all the
rows rather than one:
http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html

- Perrin
Thread
Error with max and group byJoe Pearl21 Jun
  • Re: Error with max and group byPerrin Harkins21 Jun
    • Re: Error with max and group byJoe Pearl21 Jun
      • Re: Error with max and group byPerrin Harkins21 Jun
  • Re: Error with max and group byBrent Baisley21 Jun