Re: Is it possible to make the order of output the same as the order of input parameters?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is it possible to make the order of output the same as the order of input parameters?
Date: 2010-06-02 14:47:01
Message-ID: 20100602144700.GA16766@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Sam Mason :
> Isn't this fun; here's another version using window functions (from PG
> 8.4 onwards) this time:
>
> SELECT c.*
> FROM customer c, (
> SELECT *, row_number() OVER ()
> FROM (VALUES (23), (56), (2), (12), (10)) x) x(val,ord)
> WHERE c.id = x.val
> ORDER BY x.ord;

Wow, that's really cool and a nice case for row_number().
Thx.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ernesto Quiñones 2010-06-02 14:53:51 Re: PosttgreSQL on AIX
Previous Message David Fetter 2010-06-02 14:46:33 Re: Is it possible to make the order of output the same as the order of input parameters?