Re: Strange sequences - how to construct?

Поиск
Список
Период
Сортировка
От Alexey M Boltenkov
Тема Re: Strange sequences - how to construct?
Дата
Msg-id 6b774981-3126-0606-5a17-59fb125a213c@yandex.ru
обсуждение исходный текст
Ответ на Strange sequences - how to construct?  (SQL Padawan <sql_padawan@protonmail.com>)
Список pgsql-novice
On 10/22/21 22:29, SQL Padawan wrote:

Good afternoon to everybody.

I wish to construct some weird sequences.

1
1
2
2
&c.

and with  3 ones, 4 ones... &c.

Now, I know how to do a simple
1
2
3
4

using both GENERATE_SERIES and using a RECURSIVE CTE.

What I would like is to be able to construct my specified sequences using *_both_* GENERATE_SERIES *_and_* RECURSIVE CTEs.

Regards,

SQL Padawan!




Sent with ProtonMail Secure Email.

Or may be you want something strange?

*_both_* GENERATE_SERIES *_and_* RECURSIVE CTEs: with recursive x as ( select generate_series(1, 5) x union all select x + 1 from x where x = x - 1) select unnest(array[x, x]) x from x;

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

Предыдущее
От: Alexey M Boltenkov
Дата:
Сообщение: Re: Strange sequences - how to construct?
Следующее
От: Greg Rychlewski
Дата:
Сообщение: nested loop joins