Re: How to do?

From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: R(dot)Partyka(at)wdg(dot)pl
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to do?
Date: 2003-08-01 15:34:25
Message-ID: 1059752065.10894.27.camel@taz.oficina
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't know if this is the best solution, but a temp sequence should
work:

CREATE TEMP SEQUENCE tmp_seq;
SELECT
nextval('tmp_seq') AS row_num,
<column list>
FROM
<tables>
WHERE
<where statement>;
DROP SEQUENCE tmp_seq;

And about the rows before and after that you ask, I don't understand...
based on what you mean *before* and *after*? you don't have an order by
clause.

And what do you mean with "I know that in result is record with e.g.
uid='AC13A1'"?
You know this uid *before* sending the query? is it part of your <where
statement>? can you use this value as a hard coded condition for a
subquery?

PS: I don't think your questions are silly.

On Wed, 2003-07-30 at 07:17, Robert Partyka wrote:

> Hi,
>
> Have question....
>
> How to do such like this:
>
> I have: select <column list> form <tables> where <where statement>;
> how to make one column be row numbers in result?
>
> and second one:
> have select like above.... and I know that in result is record with e.g.
> uid='AC13A1'.
> How to reduce result to this record and one record before in result and one
> record after in result?
>
> Are this questions just silly problems? :-)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-08-01 15:35:55 Re: How to do?
Previous Message Johnson, Shaunn 2003-08-01 15:27:13 Re: PC color icon data?