Re: query based on row number for psql8.3 - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: query based on row number for psql8.3
Date
Msg-id 56F2DB73.2070703@aklaver.com
Whole thread Raw
In response to query based on row number for psql8.3  (Emi <emilu@encs.concordia.ca>)
List 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.klaver@aklaver.com



pgsql-sql by date:

Previous
From: Emi
Date:
Subject: query based on row number for psql8.3
Next
From: Stephen Tahmosh
Date:
Subject: Re: query based on row number for psql8.3