KX Community

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

Home Forums kdb+ parse tree not working for simple select Re: parse tree not working for simple select

  • mchbrn-q

    Member
    October 11, 2022 at 12:00 am

    It’s not entirely clear what you are trying to achieve when you only supply two broken queries.

    Adding where to your query was a suggestion based on the return type being a list of booleans. Using where with your query returns the indexes of tab where c2>16. This could then be fed back into the table to return the desired data.

    q)tab where ?[tab;til 10;(>;`c2;16)] 
    c1 c2 
    ----- 
    7 17 
    8 18 
    9 19

    You’ll need to use semicolons to form a valid parse tree as shown here https://code.kx.com/q/wp/parse-trees/#eval-and-value like you have used in your first query but not your second.

    This was all based off the assumption that you were attempting to use simple execs in functional form https://code.kx.com/q/basics/funsql/#simple-exec