Re: query based on row number for psql8.3

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: emilu(at)encs(dot)concordia(dot)ca, pgsql-sql(at)postgresql(dot)org
Subject: Re: query based on row number for psql8.3
Date: 2016-03-23 18:07:47
Message-ID: 56F2DB73.2070703@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephen Tahmosh 2016-03-23 18:09:49 Re: query based on row number for psql8.3
Previous Message Emi 2016-03-23 18:00:36 query based on row number for psql8.3