Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORDER by This then That - possible?

Status
Not open for further replies.

jimoblak

Instructor
Oct 23, 2001
3,620
US
I want to display the contents of a record set based on the order of state, then by the order of city in each state. Is there a simple ORDER by command that can pull this off?

Like:
SELECT State, City FROM Addresses ORDER by State, City

Expected output:
Ohio Cincinnati
Ohio Columbus
Ohio Dayton
Oklahoma Pierpont
Utah Salt Lake City
 
DOH!

I just tried my sample query and it worked. Sometimes my ignorance impresses myself.

ASC and DESC can be also used immediately after the column name to sort by ASCending or DESCending order.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top