Re: Sort before grouping

2006-01-30 Thread Michael Stassen
David Förster wrote: Hi, is there any way to get datasets sorted before they're grouped by GROUP BY()? I have a table of events at different locations and want to select the newest one for each location. However "SELECT * FROM events GROUP BY location ORDER BY date DESC" gives me just some eve

Re: Sort before grouping

2006-01-30 Thread Peter Brawley
David, I have a table of events at different locations and want to select the newest one for each location. Famous & oft-asked, how to retrieve a groupwise-max values. See http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.html PB - David Förster wrote: Hi, is t

Sort before grouping

2006-01-30 Thread David Förster
Hi, is there any way to get datasets sorted before they're grouped by GROUP BY()? I have a table of events at different locations and want to select the newest one for each location. However "SELECT * FROM events GROUP BY location ORDER BY date DESC" gives me just some event per location and the