Thread: serie of serie

serie of serie

From
Olivier Leprêtre
Date:

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

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

Re: serie of serie

From
Rory Campbell-Lange
Date:
On 18/04/20, Olivier Leprêtre (o.lepretre@gmail.com) wrote:
> I would like to generate a serie of serie and didn’t find how.  With
> generate_series. I can generate a serie
...
> But how can I repeat this serie several times ?

Something like this?

gotest=> select a, b from generate_series(1, 3) as t(a), generate_series(1, 3) as u(b);
     a | b 
    ---+---
     1 | 1
     1 | 2
     1 | 3
     2 | 1
     2 | 2
     2 | 3
     3 | 1
     3 | 2



Re: serie of serie

From
Achilleas Mantzios
Date:


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