pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tjk@tksoft.com <tjk@tksoft.com>
To: BIngram@sixtyfootspider.com
Cc: mig@utdt.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: Threaded Records in SQL: Advice Needed
Date: Tue, 11 Apr 2000 15:32:39 -0700 (PDT)
Message-ID: <200004112232.PAA23653@uno.tksoft.com> (raw)
In-Reply-To: <9B7D4396307CD311809A00500415EB405FE1E9@BKMAIL>

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
> 
> 
> 




view thread (10+ messages)  latest in thread

Message-ID: <200004112232.PAA23653@uno.tksoft.com>
Permalink:  ../200004112232.PAA23653@uno.tksoft.com/
Also on:    postgresql.org/message-id/200004112232.PAA23653@uno.tksoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tjk@tksoft.com, BIngram@sixtyfootspider.com, mig@utdt.edu
  Subject: Re: Threaded Records in SQL: Advice Needed
  In-Reply-To: <200004112232.PAA23653@uno.tksoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox