General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

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:
  #1  
Old January 6th, 2004, 02:26 AM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 117 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 29 sec
Reputation Power: 6
query - order

Hi guys,

is there anyway i can put the query results in the order i want according to two values ??

Now i have a table with two columns.. one is image column and the other one is item

i want to display all records according to these orders:
- display the records with image first and put the records with image column empty at the bottom..
<-- this can be done be sorting the image column..

now i want to sort the records once again by their name.. thats mean items start with letter 'a' will be on top of the display.. same goes to the records that with empty image column,, but the records without any entry in the image column will be shown after records with data in image column..

do u guys get what i am trying to say.. hope u guys can understand what i wanna ask..

i want it to display something like this:
e.g:
joj.jpg Chair
all.gif Table
Bench
Cup

please advise..

Reply With Quote
  #2  
Old January 6th, 2004, 03:18 AM
Relax Relax is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 43 Relax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
"SELECT * FROM table ORDER BY columname" or "SELECT * FROM table ORDER BY columname DESC" (desc = descending reverses the order)

hope that's what u meant.. basics of sql btw should be on http://www.w3schools.com

can also sort it by 2 values.. ORDER BY columname1, columname2.. sorts em for col1 first then the 2nd

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > query - order


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
Stay green...Green IT