grouping results from a query



i need some help with grouping. i have a large set of results and i'm hoping to make them more readable.

each result has a location field and many of the locations are the same

i would like my results to display as follows:

location 1

field1, field2
field1, field2
field1, field2

location 2

field1, field2
field1, field2

at the moment i just have a select statment orderd by location and then echo's for each field, can anyone give me some example code to group the results by location field?

many thanks
The easiest way to do this would be in PHP: have a standard loop to loop through the result set, and have PHP keep track of the current location in a temporary variable. Each time through the loop, PHP should compare the location to the previous location (stored in the temporary variable), and if they're different (i.e. it's a new location), output the location. If they're not different, then don't output the location.