pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Stephen Tahmosh <stahmosh@shieldsrx.com>
To: Rob Sargent <robjsargent@gmail.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: query based on row number for psql8.3
Date: Wed, 23 Mar 2016 18:57:30 +0000
Message-ID: <DM2PR0701MB129587555E8F1F08B83ADF2EC4810@DM2PR0701MB1295.namprd07.prod.outlook.com> (raw)
In-Reply-To: <56F2DFDC.2020408@gmail.com>
References: <56F2D9C4.9010304@encs.concordia.ca>
<56F2DFDC.2020408@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Rob Sargent
Sent: Wednesday, March 23, 2016 2:27 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] query based on row number for psql8.3
On 03/23/2016 12:00 PM, Emi wrote:
> Hello,
>
> For psql8.3, is there a simple way to query based on row number please?
>
> For example,
>
> select case
> when row_num=1 THEN t1.tot_hr
> ELSE t1.tot_hr - t1.pre_hr
> END
> FROM t1 ;
>
>
>
>
>
I seem to recall other posts from condordia: Someone needs to take of
their skates and update postgres!
[ST]
I'm not sure if this link works, as I don't have access to 8.3
http://postgresql.nabble.com/How-to-realize-ROW-NUMBER-in-8-3-td4328448.html
If this works, then wrap the query with a main query that uses "rownum" in the case statement.
STeve
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
THIS MESSAGE (AND ALL ATTACHMENTS) IS INTENDED FOR THE USE OF THE PERSON OR ENTITY TO WHOM IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message without making any copies and notify the sender so that we may correct our records. Thank you.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (10+ messages) latest in thread
Message-ID: <DM2PR0701MB129587555E8F1F08B83ADF2EC4810@DM2PR0701MB1295.namprd07.prod.outlook.com>
Permalink: ../DM2PR0701MB129587555E8F1F08B83ADF2EC4810@DM2PR0701MB1295.namprd07.prod.outlook.com/
Also on: postgresql.org/message-id/DM2PR0701MB129587555E8F1F08B83ADF2EC4810@DM2PR0701MB1295.namprd07.prod.outlook.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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: stahmosh@shieldsrx.com, robjsargent@gmail.com
Subject: Re: query based on row number for psql8.3
In-Reply-To: <DM2PR0701MB129587555E8F1F08B83ADF2EC4810@DM2PR0701MB1295.namprd07.prod.outlook.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