MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 11th, 2005, 10:11 AM
trig trig is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 trig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 12 sec
Reputation Power: 0
Dual Order By?

Simplistic Query:


$query="SELECT * FROM usedcars WHERE list='yes' ORDER BY 'make'";

However I need to have it order by 'model' as well after it's sorted my make. Can MySql do this easily or do I need to hand build a repeating sorter?

What I assumed and failed:
$query="SELECT * FROM usedcars WHERE list='yes' ORDER BY 'make' ORDER BY 'model'";

Thanks for any suggestions!

Last edited by trig : April 11th, 2005 at 10:12 AM. Reason: Didn't change email notification.

Reply With Quote
  #2  
Old April 11th, 2005, 12:05 PM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
Try

Code:
 SELECT
  * 
 FROM 
  usedcars 
 WHERE 
  list = 'yes' 
 ORDER BY 
  make,
  model
 


And don't put single quotes around column names (you can use backticks, but not quotes).

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Dual Order By?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway