List:General Discussion« Previous MessageNext Message »
From:mos Date:January 23 2004 3:37pm
Subject:Re: Order by problem
View as plain text  
At 06:49 AM 1/23/2004, Sagar C Nannapaneni wrote:
>Hi all,
>
>I have an ID field in my database...it reads like this
>
>ASS1
>ASS23
>ASS4
>ASS10
>ASS6
>.
>.
>.
>
>when i'm retrieving the data by taking ORDER BY clause it is sorting like this
>
>ASS1
>ASS10
>ASS23
>ASS4
>ASS6
>
>means its only sorting by the 4 the character. i want the sorting to be 
>done like the following
>
>ASS1
>ASS4
>ASS6
>ASS10
>ASS23
>
>Solutions are greatly appreciated


Sagar,
         You can also try:

select * from table order by cast(substr(id,4) as unsigned)

Mike 


Thread
Order by problemSagar C Nannapaneni23 Jan
  • Re: Order by problemMartijn Tonies23 Jan
  • Re: Order by problemBenoit St-Jean23 Jan
  • Re: Order by problemFrederic Wenzel23 Jan
    • SELECT statementGary Broughton23 Jan
    • Re: Order by problemmos23 Jan
  • Re: Order by problemmos23 Jan