pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerald Gutierrez <gutz@kalador.com>
To: Jeff MacDonald <jeff@tht.net>
To: pgsql-sql@postgresql.org
Subject: RE: "correct" sorting.
Date: Thu, 3 May 2001 11:16:25 -0700
Message-ID: <IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.com> (raw)
In-Reply-To: <Pine.NEB.4.05.10105030038150.18863-100000@tht.net>



That list looks like an ordering that is custom to your application. The
latter sort created by the SQL seems more typical (correct?) to me.

I would return the table unsorted, and write the sorting routine in the
calling code instead.


-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Jeff MacDonald
Sent: Wednesday, May 02, 2001 9:41 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] "correct" sorting.


Hi folks,

say i have a text field with teh values

1,2,3,10,20,30,1a,1b,2a,2b

and i want to sort it so i get,

1
1a
1b
2
2a
2b
3
10
20
30

is there anyway to do that with postgresql ?
below is what actually happens.

jeff=> select * from foo order by var1;
 var1
------
 1
 10
 1a
 1b
 2
 20
 2a
 2b
 3
 30
 3a
 3b
(12 rows)


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




view thread (4+ messages)  latest in thread

Message-ID: <IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.com>
Permalink:  ../IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.com/
Also on:    postgresql.org/message-id/IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gutz@kalador.com, jeff@tht.net
  Subject: Re: "correct" sorting.
  In-Reply-To: <IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.com>
  References: <Pine.NEB.4.05.10105030038150.18863-100000@tht.net> <IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.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