结果集重复多遍

【问题】

I have a simple postgresql query which returns three fields. I want to repeat that query in a loop. My “solution” right now is copy&paste the query several times with union, but this is not flexible. I want to repeat the query the number of times indicated in a parameter by the user. How can I do that?

【回答】

重复 N 遍结果集,可以用 SPL 简单实现,代码如下:

A
1 =$select f1,f2,f3 from tb
2 =A1*argN​

A1:查询数据

A2:对结果集重复 argN 遍,argN 是参数