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

Categories

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

full join时,如何将两表的matchingCols合成一列

在dolphindb database中,有个代码如下:

t1= table(1 2 3 3 6 as time, 1.1 2.1 3.1 3.1 6.1  as value)
t2 = table(5 3 1 as time,  5.1 3.1 1.1 as qty)
fj(t1, t2, `time)

fj后的结果如下:

time    value    t2_time    qty
1        1.1        1        1.1
2        2.1        
3        3.1        3        3.1
3        3.1        3        3.1
6        6.1        
                    5        5.1

我想得到如下结果:

time    value    qty
1        1.1        1.1
2        2.1    
3        3.1        3.1
3        3.1        3.1
5                   5.1
6        6.1    

代码应该怎么写?谢谢!


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

1 Reply

0 votes
by (71.8m points)

可以用下面代码:

select  nullFill(t1.time, t2.time) as time, value, qty from fj(t1, t2, `time) order by nullFill!(t1.time, t2.time)

或者

(select  nullFill(t1.time, t2.time) as time, value, qty from fj(t1, t2, `time)).sortBy!(`time)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...