WG: [Fwd: Re: Order By Clause]

WG: [Fwd: Re: Order By Clause]

am 18.03.2005 09:16:09 von treffehn

Hi Mark


We have a similar problem.
you can solve it by dividing the number in columns, but then you get ot=
her
problems.

The only way you can sort your chapternumbers is by making them fixed
length.

you must convert
>> 1.0
>> 1.01
>> 1.10
>> 1.101
>> 2.0
>> 2.01
>> 2.2
>> 11.0
>> 20.0

to

01.000
01.001
01.100
01.101
02.000
02.001
02,002
11.000
20.000


if you dont want to change the original data, you must create an additi=
onal
column
for sorting.


mit freundlichen Grüßen

Thomas Treffehn

Hans Brochier GmbH & Co KG

Abteilung S2 - Informationswesen
Marthastraße 16
90482 Nürnberg

Fon: +49 0911-9543-355
Fax: +49 0911-9543-383
www.brochier.de

----- Weitergeleitet von Thomas Treffehn/BROCHIER/DE am 18.03.2005 09:1=
1
-----
|---------+----------------------------->
| | Mark Love |
| | | | erve.co.uk> |
| | |
| | 17.03.2005 16:59 |
| | Bitte antworten an|
| | mark |
|---------+----------------------------->
>----------------------------------------------------------- ---------=
-----------------------------------------------------------|
| =
|
| An: Mysql list =
|
| Kopie: =
|
| Thema: [Fwd: Re: Order By Clause] =
|
>----------------------------------------------------------- ---------=
-----------------------------------------------------------|





Erich Dollansky wrote:

>
>> I need to come up with a way of ordering a varchar field of the form=

>> 1.x.x.x numerically .
>> The number of fields after the x may be dynamic (0 or more).
>> So for instance I may have :
>> 1.0
>> 1.01
>> 1.10
>> 1.101
>> 2.0
>> 2.01
>> 2.2
>> 11.0
>> 20.0
>>
>> Does anyone have any idea how I might be able to do this?
>>
> It does not work as long as you do not right-align the data.
>
> Your problem is that you do not know the length of a VARCHAR field.
>
> Can you change the design to a fixed field length?
>
Hi Erich,
Thanks for answering.
I can make it a fixed field but the numbering system is still variable =
(
1.0,1.01,1.001,1.1.0,1.2.1 etc).
How would this help?
They're chapter numbers for books .

Mark

--

Regards,

*Mark*





--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dtreffehn@brochi=
er.de
=



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org