On 1/16/11 5:22 AM, Jørn Dahl-Stamnes wrote:
> mysql> select album_id, updated_at, created_at from album_stats group by
> album_id order by updated_at desc limit 8;
I believe that your problem is that the group by happens before the
order by. Since you're grouping, the updated_at column is not
deterministic. If there are multiple rows per album_id, any one of
those rows could provide the updated_at column that you're then using to
order by. What you probably want is to select (and order by) the
max(updated_at).
Steve