mysql sort by two fields ORDER by 2

Mobile
feeds
Welcome Login | Register

mysql sort by two fields ORDER by 2
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » MYSQL Forums
        » » mysql sort by two fields ORDER by 2
mysql sort by two fields ORDER by 2
Post Description: mysql sort by two fields order by 2 MYSQL
Post Tags:
This Post Has Been Viewed 993 Times Since Mon Apr 28, 2008 1:41 pm Author hostman with 1 replies
mysql sort by two fields ORDER by 2
Advertise On This Page




today i wanted to learn how i can order a query in a mysql database by two fields

this is how i did this

$sql = SELECT this FROM thistable ORDER BY this, andthis



Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : mysql sort by two fields ORDER by 2

Comments and replies About mysql sort by two fields ORDER by 2
:: 1 :: Reply #114138 Reply By Rahul On Sat Aug 29, 2009 10:51 am
Rahul:
hi, i need to use order by in other directions like : date desc and priority asc

i used this : select * from tablename where category = '1' order by date desc, priority asc limit 30

this is not working right

if use this :

select * from tablename where category = '1' order by priority, date desc limit 30

this is working but i want date desc first then priority asc, how to do this please help

rahul