Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
521 views
in Technique[技术] by (71.8m points)

请问怎么把三张表横向拼接成一张表

假设在dolphindb database中有三张表如下:

t1=table(1..3 as id1,4..6 as v1)
t2=table(4..6 as id2,5..7 as v2)
t3=table(7..9 as id3,6..8 as v3)

现在要把它并成如下一张表:
image.png
即这张表的列是三张表的所有列的合集。请问在dolphindb中有什么简单的方法?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
t1.join(t2).join(t3)

如果要join的表很多,而且存储在一个tuple中,这时可以使用高阶函数reduce和join函数配合使用

collections = [t1, t2,t3]
reduce(join, collections)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...