Re: How to do?

Поиск
Список
Период
Сортировка
От Franco Bruno Borghesi
Тема Re: How to do?
Дата
Msg-id 1059752065.10894.27.camel@taz.oficina
обсуждение исходный текст
Ответ на Re: How to do?  (Ron Johnson <ron.l.johnson@cox.net>)
Список 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? :-)
Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "Johnson, Shaunn"
Дата:
Сообщение: Re: PC color icon data?
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: How to do?