RE: "correct" sorting.

From: "Gerald Gutierrez" <gutz(at)kalador(dot)com>
To: "Jeff MacDonald" <jeff(at)tht(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Subject: RE: "correct" sorting.
Date: 2001-05-03 18:16:25
Message-ID: IIEOKIIOJMELMIFMMEBFEEMGCCAA.gutz@kalador.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Jeff MacDonald
Sent: Wednesday, May 02, 2001 9:41 PM
To: pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-05-03 18:32:56 Re: '13 months ago'::reltime
Previous Message Subhramanya Shiva 2001-05-03 18:14:50 Re: How to encode and decode password in pgsql !!