Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPnTl-0005fP-Ab for pgsql-general@arkaria.postgresql.org; Sat, 18 Apr 2020 13:25:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPnTj-0007Zu-Hc for pgsql-general@arkaria.postgresql.org; Sat, 18 Apr 2020 13:25:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPnTj-0007Yj-4w for pgsql-general@lists.postgresql.org; Sat, 18 Apr 2020 13:25:51 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPnTb-0003Wj-DC for pgsql-general@lists.postgresql.org; Sat, 18 Apr 2020 13:25:49 +0000 Received: from hercules.internal.net (hercules.internal.net [10.9.200.8]) by hermes.gatewaynet.com (8.15.2/8.15.2/Debian-8) with ESMTP id 03IDPejB026433 for ; Sat, 18 Apr 2020 16:25:40 +0300 Received: from [10.9.251.249] (dcmchgw.internal.net [10.9.0.1]) by hercules.internal.net (Postfix) with ESMTPS id 6F1A71350AEA for ; Sat, 18 Apr 2020 16:25:37 +0300 (EEST) Subject: Re: serie of serie To: pgsql-general@lists.postgresql.org References: <04d801d61551$8d6acf90$a8406eb0$@gmail.com> From: Achilleas Mantzios Message-ID: <0daf254f-873b-3c25-da03-e3c0d39e4893@matrix.gatewaynet.com> Date: Sat, 18 Apr 2020 16:25:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <04d801d61551$8d6acf90$a8406eb0$@gmail.com> Content-Type: multipart/alternative; boundary="------------FC658709A4A6C1C8B9268BB8" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.101.4 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE, T_REMOTE_IMAGE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------FC658709A4A6C1C8B9268BB8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 18/4/20 10:18 π.μ., Olivier Leprêtre wrote: > > Hi, > > I would like to generate a serie of serie and didn’t find how.  With > generate_series. I can generate a serie > > 1 > > 1 > > 1 > > 2 > > 2 > > 2 > > 3 > > 3 > > 3 > > But how can I repeat this serie several times ? > > 1 > > 1 > > 1 > > 2 > > 2 > > 2 > > 3 > > 3 > > 3 > > 1 > with foo as (select floor(a) as a from generate_series(1.33333333333333333333,4,1.0/3.0) as s(a)) select foo.a from foo, generate_series(1,10) as itera(b) order by b,a; > 1 > > 1 > > 2 > > 2 > > 2 > > 3 > > 3 > > 3 > > 1 > > 1 > > 1 > > 2 > > 2 > > 2 > > 3 > > 3 > > 3 > > Thanks for any help, > > > > Garanti sans virus. www.avast.com > > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> --------------FC658709A4A6C1C8B9268BB8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 18/4/20 10:18 π.μ., Olivier Leprêtre wrote:

Hi,

 

I would like to generate a serie of serie and didn’t find how.  With generate_series. I can generate a serie

 

1

1

1

2

2

2

3

3

3

But how can I repeat this serie several times ?

1

1

1

2

2

2

3

3

3

1


with foo as (select floor(a) as a from generate_series(1.33333333333333333333,4,1.0/3.0) as s(a))
select foo.a from foo, generate_series(1,10) as itera(b) order by b,a;

1

1

2

2

2

3

3

3

1

1

1

2

2

2

3

3

3

 

Thanks for any help,

 

 


Garanti sans virus. www.avast.com
--------------FC658709A4A6C1C8B9268BB8--