2 Sort by's

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

2 Sort by's

Post by nickman013 »

Hello,

I need to sort two querys. Like I have a sort by ID but now I need it to be sort by ID and then somethign else. So it puts everything in order by ID and then by the other number.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

...why? :?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Is there a question in that post nickman013? I don't see one.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Looks like he's asking how to sort by 2 fields in a query, something like..

Code: Select all

SELECT * FROM `table` WHERE `fieldOne`='this' ORDER BY `fieldTwo`,`fieldThree` ASC;
Shouldn't be too far off.
Post Reply