Re: increment counter in VIEW

Поиск
Список
Период
Сортировка
От Oleg
Тема Re: increment counter in VIEW
Дата
Msg-id 44B50F25.7080304@iwg.uka.de
обсуждение исходный текст
Ответ на Re: increment counter in VIEW  (Richard Broersma Jr <rabroersma@yahoo.com>)
Ответы Re: increment counter in VIEW  (Richard Broersma Jr <rabroersma@yahoo.com>)
Re: increment counter in VIEW  (Bruno Wolff III <bruno@wolff.to>)
Re: increment counter in VIEW  (Oleg <evdakov@iwg.uka.de>)
Список pgsql-novice
Dear Richard,
Thank you very much for your link. It looks like it could do the job I want.
Unfortunately I have problem with inserting this functionality into my VIEW
I tried:
CREATE OR REPLACE VIEW my_view AS SELECT
       S.a AS test,
        knoten."GEOMETRY",
        knoten.knoten,
FROM
         generate_series(1,300) AS S(a),
         knoten knoten
WHERE
          knoten.knoten::text = knoten_flaeche.knoten::text;

Without generate_series my View produces 300 records. if I insert
generate_series then I get 90000 because it tries all possible
combinations with S.a. I do not know how can I limit it with WHERE.

I also tried to work with SEQUENCES but each time we update sequence it
continue to count from the last number. For example from 1-300 then from
300-600, etc.

We would be very grateful if you or somebody on this list could help us
further.

Thanks a lot in advance,
Oleg


Richard Broersma Jr schrieb:
>> Dear All,
>> Does anybody know how to add increment counter column to VIEW? To get
>> something like this
>>
>> cntrColumn | anotherCol
>> ------------------------
>> 1                 |  val1
>> 2                 |  val2
>> 3                 |  ..
>> 4                 |
>>
>> The best if this counter will be executed together with sort to ensure
>> that sertain record gets always the same Counter value.
>>
>
> I am not sure if generate_series is what you want.
> http://www.postgresql.org/docs/8.1/interactive/functions-srf.html
>
> Regards,
> Richard Broersma Jr.
>
>


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

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: increment counter in VIEW
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: increment counter in VIEW