MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2012, 09:51 AM
atmaling atmaling is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 atmaling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 19 sec
Reputation Power: 0
Order by for String numbers

Hi,
I am having following values in class_name column of the student table.
5th,6th,7th,8th,9th,10th.

But when I write following query:

Code:
select class_name from student order by class_name


It returns as:
10th
5th
6th
7th
8th
9th

But I want the O/P as below:

5th
6th
7th
8th
9th
10th

Please help me.

Thanks in Advance...!!

Last edited by Guelphdad : October 12th, 2012 at 10:24 AM. Reason: swapped code for mysql in display

Reply With Quote
  #2  
Old October 12th, 2012, 10:25 AM
Guelphdad's Avatar
Guelphdad Guelphdad is offline
Hockey face
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: St. Catharines, Canada
Posts: 8,141 Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 20 h 34 m 13 sec
Reputation Power: 1315
try this:
Code:
ORDER BY class_name + 0

Reply With Quote
  #3  
Old October 12th, 2012, 10:53 AM
atmaling atmaling is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 atmaling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 19 sec
Reputation Power: 0
Thanks

Thanks Very much Guelphdad.
It worked...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Order by for String numbers

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap