[thelist] MySQL Grouping problem

Joshua Olson joshua at waetech.com
Mon Apr 11 15:45:44 CDT 2005


> -----Original Message-----
> From: Richard Livsey
> Sent: Monday, April 11, 2005 3:02 PM
> 
> How do I get a list of the places nearest to the point, 
> limited by type?
> 
> I've tried:
> 
> SELECT *
> FROM places
> GROUP BY type
> ORDER BY distance ASC

As Matt pointed out, that query should throw an error as you selected
columns that are not grouped and are not aggregated.  Must be some sort of
MySQL oddity...

> Which groups by type fine, but doesn't order them by distance 
> within the  grouping. IE the following

This particular problem is non-trivial when you use a database that does
support subselects, and darned near impossible with one that does not.
Which version of MySQL are you targetting?


<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the thelist mailing list