List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:August 10 1999 6:58pm
Subject:Re: Order By Problem
View as plain text  
Ping Lau wrote:
> 
> -----Original Message-----
> From: Paul DuBois <paul@stripped>
> To: Ping Lau <pinglau@stripped>; mysql@stripped
> <mysql@stripped>
> Date: Monday, August 09, 1999 11:29 PM
> Subject: Re: Order By Problem
> 
> >At 12:10 PM -0500 8/10/99, Ping Lau wrote:
> >>I have a simple table POITEM looks like this:
> >>
> >>po char(10)
> >>itemno char(10)
> >>desc char(50)
> >>unitprice float(4)
> >>
> >>I have inserted 11 items against PO number 123.  The item numbers are 1,
> 2,
> >>3, 4, 5, 6, 7, 8, 9, 10, 1A.  I then tried to query PO 123,
> >>
> >>select * from poitem where po = "123" order by itemno
> >>
> >>But the result did not show item numbers in the correct order: 1, 10, 2,
> 3,
> >>4, 5, 6, 7, 8, 9,1A!  How can I force item number 10 to appear after 1A?
> >
> >
> >You're trying to sort strings as though they are numbers.
> >
> >Why?
> >
> >--
> >Paul DuBois, paul@stripped
> 
> Because I don't have a choice.  Some of the purchase orders sent over by our
> customers have strange item numbers.  I have seen item number 001A11, 2A10,
> 1.1.A, etc.  So I have to assign itemno as char data type.
> 
> Regards,
> Ping

Hi Ping

If this is really the case, then ordering on this column is not that useful anyway.

But if you really nead a proprietary sorting order, then you should add another column,
which contains the needed sorting.

Tschau
Christian

Thread
Order By ProblemPing Lau10 Aug
  • Re: Order By ProblemPaul DuBois10 Aug
    • Re: Order By ProblemMartin Ramsch10 Aug
Re: Order By ProblemMagnus Hammar10 Aug
  • Reply-To (was: Order By Problem)Martin Ramsch10 Aug
  • Re: Order By Problem(Paul D. Smith)10 Aug
Re: Order By ProblemPing Lau10 Aug
  • Re: Order By ProblemRaghu Machepalli10 Aug
  • Re: Order By ProblemChristian Mack10 Aug
Re: Order By ProblemPing Lau11 Aug