cursor.execute("SELECT user_id FROM myapp_location WHERE\
GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s"\
,(user_utm_easting, user_utm_northing, 500));
This query selects users which are within 500 feet of the current user. How would I order people by the distance? (the glength). Nearby first, farthest last.
How would you change this query? THanks.