2017-06-01 37 views
2

我有两个表,它们有一些共同的列和一些其他表没有的列。KDB附加不同列的表

atab:flip `items`sales`prices`athing!(`anut`abolt`acam`acog;6 8 0 3;10 20 15 20; 50.2 32.6 1.18 -3.9) 

btab:flip `items`sales`prices`bthing!(`bnut`bbolt`bcam`bcog;6 8 0 3;10 20 15 20; 1 0 0 1) 

,我想将它们组合起来,使得列设置两个表的工会,所以在我的情况下,列会的项目,销售,价格,athing,bthing以及其中初始表犯规有一个相应的列,被充斥着一些N/A值

在这里,这对于失败

atab upsert btab 

错误

ERROR:mismatch 

我可以(轻松地)做到这一点吗?

回答

4
q)atab uj btab 
items sales prices athing bthing 
-------------------------------- 
anut 6  10  50.2 
abolt 8  20  32.6 
acam 0  15  1.18 
acog 3  20  -3.9 
bnut 6  10   1 
bbolt 8  20   0 
bcam 0  15   0 
bcog 3  20   1 

http://code.kx.com/q/ref/joins/#uj-ujf-union-join

+0

完美,非常感谢 – chrise