我有一个Postgres表,其中有一列
ColumnA
x1
x2
x3
x4
...
x100如何使用postgresql将函数f应用于该列中的每两个项目,并得到如下结果:
ResultColumn
f(x1, x2)
f(x1, x3)
....
f(x1, x100)
...
f(x99, x100)发布于 2020-07-29 18:51:01
这看起来像是一个Caretesian产品:
select t1.columnA, t2.columnA, f(t1.columnA, t2.columnA)
from t t1 join
t t2
on t2.columnA > t1.columnA;这只是半个笛卡尔乘积。
https://stackoverflow.com/questions/63151019
复制相似问题