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