2017-06-01 38 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