Hey guys, 1 month new to q/kdb+. Hoping someone can help me out. Ill keep it simple:
Table 1:- has Alot of rows, need all of them
A | B
1 | 10
2 | 20
3 | 30
Table 2:- small number of rows but has multiple entries for each
A | C
1 | 100
2 | 200
2 | 300
What i want as output:
A | B | C
1 | 10 | 100
2 | 20 | 200
2 | 20 | 300
3 | 30 |
In simple words:
table1 lj table2 when table2 is unkeyed. so want to add table1 rows multiple times for each matching row in table2. Finally need all rows of table1.
What all I tried:
-
LJ:- t2 lj t1 could’ve worked but wont give me the extra rows of table1
-
UJ:- needs both to be keyed or both unkeyed. Both unkeyed gives this-
A | B | C
1 | 10 |
2 | 20 |
3 | 30 |
1 | | 100
2 | | 200
2 | | 300Its a simple kind of join but seems to require some preprocessing with ungroup and groupby or something. Was wondering if there’s a simple way to do this.