Jump to content

[SOLVED] Ordering by mutliple fields


pugboy

Recommended Posts

I have two columns:

 

order

AND

orderid

 

How can I get all of the pages (which is what I am trying to order) to be ordered by the order column, then ordered by their ID?

 

I tried ORDER BY `order` ASC, `orderid` ASC but it does not come out correctly...

 

An example of what I want but can't seem to get to work:

 

Page ID name - Order - Order ID:

home - / - 1

docs - / - 2

user - /docs/ - 1

developer - /docs/ - 3

administrator -  /docs/ - 2

 

I can't get the array to be ordered like this:

 

home

docs

user

administrator

developer

 

Is there a better way to do what I am trying to achieve, or am I not using the multiple order by thing correctly?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.