Home › Forums › kdb+ › SQL query to Functional query[Parse Tree] › Re: SQL query to Functional query[Parse Tree]
-
Hi Richard,
Instead of using the list structure, try simply using the dictionary with the key as the first clause e.g.
q)t1:([]c1:`a`b`c;c2:1 2 3); q)t2:([]c1:`d`e`f;c2:4 5 6); q)d:`t1`t2!(t1;t2); q)d t1| +`c1`c2!(`a`b`c;1 2 3) t2| +`c1`c2!(`d`e`f;4 5 6) q)?[d[`t1];();0b;()]; c1 c2 ----- a 1 b 2 c 3
Note – If you are purely selecting from the dictionary, you don’t need to use functional form at all. Simply pass the table name key into your dictionary:
q)d[`t1] c1 c2 ----- a 1 b 2 c 3 q)d[`t2] c1 c2 ----- d 4 e 5 f 6
Hope this helps,
David