SahidGuest
If I wish to join two tables on column names that are different what can I do?
Most joins in kdb+ rely on column names matching, the easiest way would be to rename the columns.
e.g.
q)t:([] a:1 2 3; b:4 5 6; c:7 8 9)
q)u:([A:1 3] uval:`ppp`ooo)
q)t
a b c
—–
1 4 7
2 5 8
3 6 9
q)u
NA| uval
–| —-
1 | ppp
3 | ooo
q)t lj u
k){$[$[99h=@t:v y;98h=@. t;0];[n:#+!y;n!x 0!y];x y]}
‘NA
@
,\:[;(+(,`NA)!,1 3)!+(,`uval)!,`ppp`ooo]
+`a`b`c!(1 2 3;4 5 6;7 8 9)
q.Q))\
q)
q)t lj `a xcol u
a b c uval
———-
1 4 7 ppp
2 5 8
3 6 9 ooo
More information on kdb+ joins can be found at:
http://www.timestored.com/kdb-guides/qsql-inner-left-joins