Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: -- Sorting is nice ?!?
Andre wrote:
> Hello all,
>
> In a database I have a char field in which i store my chapter numbers (for a book)
>
> So the fiels are like this:
> 1.1
> 1.1.1
> 1.2
> 1.6
> 1.10
> 2.2
>
> etc...
> But When i sort these Chapters I get:
> 1.1
> 1.1.1
> 1.10
> 1.2
> 1.6
> 2.2
>
>
> So chatper 1.10 is before chapter 1.2?
>
>
> How can i solve this?
>
> regards and thanks,
>
> Anneke
> The Netherlands
The easiest way is to add an additional column to your table.
If you were writing an application I'd suggest writing a function that returns the correct numbering and then sort by FUNCTION(column).
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Fri Apr 09 2004 - 08:28:38 CDT