Received: from as.tksoft.com (gyw.com [209.55.67.177] (may be forged)) by hub.org (8.9.3/8.9.3) with ESMTP id SAA59443 for ; Tue, 11 Apr 2000 18:26:12 -0400 (EDT) (envelope-from tjk@tksoft.com) Received: (from tjk@tksoft.com) by uno.tksoft.com (8.8.8/8.8.8) id PAA23653; Tue, 11 Apr 2000 15:32:39 -0700 From: "tjk@tksoft.com" Message-Id: <200004112232.PAA23653@uno.tksoft.com> Subject: Re: Threaded Records in SQL: Advice Needed To: BIngram@sixtyfootspider.com (Ingram Bryan) Date: Tue, 11 Apr 2000 15:32:39 -0700 (PDT) Cc: mig@utdt.edu, pgsql-sql@postgresql.org In-Reply-To: <9B7D4396307CD311809A00500415EB405FE1E9@BKMAIL> from "Ingram, Bryan" at Apr 11, 0 02:57:00 pm Content-Type: text X-Archive-Number: 200004/115 Bryan, You can numerically, even if the field is a text field, if all fields have a number. Just cst to an int4. E.g. create table testtable (num text, num2 text); select num from testtable order by num::int4; Troy > > Thanks for the ideas on the functions, that'll work nicely. > > The only other problem I see in actually implementing this, is that the id > column i.e. /25/10/2/ will not be ordered correctly because it relies on > ascii values. You get alphabetic orderings, rather than numerical. > > Such as: > > 1 > 10 > 11 > 12 > 14 > 2 > 20 > 25 > 3 > 4 > 5 > > instead of > > 1 > 2 > 3 > 4 > 5 > 10 > 11 > 12 > 14 > 20 > 25 > > Any ideas how to get around this? I'm working on the problem right now, but > haven't found anything yet. > > Bryan > > >