pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSQL specified sort
2+ messages / 2 participants
[nested] [flat]
* SQL specified sort
@ 2001-05-25 17:29 jeffrey morrison <morrisonjeffrey@hotmail.com>
2001-05-28 13:29 ` Re: SQL specified sort tjk@tksoft.com <tjk@tksoft.com>
0 siblings, 1 reply; 2+ messages in thread
From: jeffrey morrison @ 2001-05-25 17:29 UTC (permalink / raw)
To: pgsql-sql
I was wondering if you could help me out with a problem I'm having. Say for
example I have data coming out like:
H29
214
200
099
How would I use a sort to be able to make the output look like
214
H29
200
099
I don't believe their is a way to do an ORDER BY in a specific order. Any
help you could give me this problem would be very much appreciated.
Jeff Morrison
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: SQL specified sort
2001-05-25 17:29 SQL specified sort jeffrey morrison <morrisonjeffrey@hotmail.com>
@ 2001-05-28 13:29 ` tjk@tksoft.com <tjk@tksoft.com>
0 siblings, 0 replies; 2+ messages in thread
From: tjk@tksoft.com @ 2001-05-28 13:29 UTC (permalink / raw)
To: morrisonjeffrey@hotmail.com; +Cc: pgsql-sql
Jeff,
If you want to receive your data in an order which
you specify manually, the easiest way to accomplish this
is to add a separate field which contains an int4 value
used by you to specify the order.
E.g.
myval | sortint
_____________________
H29 | 2
214 | 1
200 | 3
099 | 4
SELECT myval FROM mytable ORDER BY sortint;
Troy
>
> I was wondering if you could help me out with a problem I'm having. Say for
> example I have data coming out like:
> H29
> 214
> 200
> 099
>
> How would I use a sort to be able to make the output look like
>
> 214
> H29
> 200
> 099
>
> I don't believe their is a way to do an ORDER BY in a specific order. Any
> help you could give me this problem would be very much appreciated.
>
> Jeff Morrison
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-28 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25 17:29 SQL specified sort jeffrey morrison <morrisonjeffrey@hotmail.com>
2001-05-28 13:29 ` tjk@tksoft.com <tjk@tksoft.com>
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