View Single Post
Old 08-22-2004, 05:53 AM   #1 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Using ORDER BY in a select statement

I want to pull several rows out of a database ordered first by city name, then by price (it's for real-estate listings). I know how to order by one field, like this:
Code:
$query = "SELECT * FROM listings WHERE 1 ORDER BY price DESC";
But how would I order it first by the city, then by the prices (from high to low) within that city so that they come out in an order like this:

city1, high-price
city1, med-price
city1, low-price
city2, high-price
city2, low-price
city3, high-price
...and so on.

Thanks for any tips.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote