I have a table with one column whose values need updating from a column in another table. Table 1 has 0 rows. I came up with an anonymous function but I get length error. I even enlisted the value. What am I missing here?
q)t1:([]a:();b:();c:())
q)t1
a b c
-----
q)t2:([]d:(1;2;3);e:("trade";"quote";"price"))
q)t2
d e
---------
1 "trade"
2 "quote"
3 "price"
q)eTab:exec distinct e from t2
q)eTab
"trade"
"quote"
"price"
{[eTab]
update a:enlist "KDB", b:enlist eTab, c:enlist "KDB" from `t1
} each eTab;
I looked at this question: kdb Update entire column with data from another table Here the original table has values in already whereas my table is empty.
Alternately, is there a better way of doing this where t1 gets updated every time there is a change in column e of t2? I looked at views here: https://code.kx.com/q/learn/views/ It is not entirely clear how this can be implemented in my case.
Thanks!