KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Why Q SQL doesn’t work with "in"? Re: Why Q SQL doesn’t work with "in"?

  • gyorokpeter-kx

    Member
    December 6, 2022 at 12:00 am

    The parameters to functional select are parse trees. These have a special rule for symbols and lists because a symbol can also represent a variable/column name, and a list can mean function invocation.

    The rule is that enlisting a value acts as an “escape” so the symbol or list is taken at face value and not evaluated. In your 3rd example, you are enlisting the symbol so it acts as a literal symbol and not a column named “a”. In the 4rd example, there is no enlist, so the list `a`b is taken as a function application, which then looks for variables or columns named a and b to perform the application. It works if you enlist the symbol list.

    ?[t;enlist (in;`c1;enlist`a`b);0b;()]