Re: Error with max and group by

2008-06-21 Thread Perrin Harkins
On Sat, Jun 21, 2008 at 8:34 AM, Joe Pearl <[EMAIL PROTECTED]> 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 ran

Re: Error with max and group by

2008-06-21 Thread Brent Baisley
Your query is just grabbing the max date within the group, but you are not specifying which record you should be pulling for the location, so it's using an arbitrary one within the group. In your query, there is not relation between max date and location. What you need to do is find out wha

Re: Error with max and group by

2008-06-21 Thread Joe Pearl
Thanks, but this is not the result I want. The SQL for the correct result is at http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group.html and I'm apparently using the correct SQL. The problem is that the columns are not coming out correctly - the rows considered for the max functio

Re: Error with max and group by

2008-06-20 Thread Perrin Harkins
On Fri, Jun 20, 2008 at 10:50 PM, Joe Pearl <[EMAIL PROTECTED]> wrote: > I want to get back only the most recent entry for each person and I don't > care about the order. I want the result to show Jim with the acq_date of > "2008-01-03", Mary and Sally with the location and date for all of them.