Re: How to do? - Mailing list pgsql-general

From Franco Bruno Borghesi
Subject Re: How to do?
Date
Msg-id 1059752065.10894.27.camel@taz.oficina
Whole thread Raw
In response to Re: How to do?  (Ron Johnson <ron.l.johnson@cox.net>)
List 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? :-)
Attachment

pgsql-general by date:

Previous
From: "Johnson, Shaunn"
Date:
Subject: Re: PC color icon data?
Next
From: Ron Johnson
Date:
Subject: Re: How to do?