agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: emilu@encs.concordia.ca
To: pgsql-sql@postgresql.org
Subject: Re: query based on row number for psql8.3
Date: Wed, 23 Mar 2016 11:07:47 -0700
Message-ID: <56F2DB73.2070703@aklaver.com> (raw)
In-Reply-To: <56F2D9C4.9010304@encs.concordia.ca>
References: <56F2D9C4.9010304@encs.concordia.ca>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On 03/23/2016 11:00 AM, Emi wrote:
> Hello,
>
> For psql8.3, is there a simple way to query based on row number please?

First FYI, 8.3 is 3 years past its end of life.

Second, Postgres does not have a built in row_num. Anything that could 
be cobbled together would be dependent on the ordering specified.

So what exactly are you trying to do?
In other words what is row_num supposed to represent?

>
> For example,
>
> select  case
>                      when row_num=1 THEN    t1.tot_hr
>                      ELSE                                  t1.tot_hr -
> t1.pre_hr
>            END
> FROM  t1 ;
>
>
>
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
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: <56F2DB73.2070703@aklaver.com>
Permalink:  ../56F2DB73.2070703@aklaver.com/
Also on:    postgresql.org/message-id/56F2DB73.2070703@aklaver.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: adrian.klaver@aklaver.com, emilu@encs.concordia.ca
  Subject: Re: query based on row number for psql8.3
  In-Reply-To: <56F2DB73.2070703@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox