Jump to content

order by twice?


EchoFool

Recommended Posts

Is it possible to order data in a primary way then a secondary way in the same query?

 

For example some thing like:

<?php
$Get = mysql_query("SELECT UserID,Title,Infomation,Allowed FROM staff ORDER BY StaffType ASC ORDER BY UserID DESC")
Or die(mysql_error());
?>

 

So you then would have the staff grouped by either admin/coder etc

followed by each group sorted by UserID like:

 

Admin:

User 2

User 1

Coder:

User 6

User 3

Link to comment
https://forums.phpfreaks.com/topic/99894-order-by-twice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.