Re: sql questions

From: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: sql questions
Date: 2018-07-20 13:07:53
Message-ID: 20180720150753.817240u65vouisis@www.gelassene-pferde.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Zitat von hamann(dot)w(at)t-online(dot)de:

> a) I am running some select query
> select ... order by ....
> Now, I would like to preserver the ordering through further
> processing by adding a sequence number
> Of course I can do:
> create temp sequence mseq;
> select xx.*, nextval('mseq') as ord from (select ... order by ....) xx;
> drop sequence mseq;
> Is there a simpler way (avoiding the create/drop parts)

Can't you just do the ordering at the end of the processing? Maybe you
need to drag along the order by columns and just dump them at the very
end if applicable.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Attachment Content-Type Size
PGP Public Key application/pgp-keys 3.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brian Dunavant 2018-07-20 14:33:31 Re: sql questions
Previous Message Laurenz Albe 2018-07-20 08:41:01 Re: sql questions