Search code examples
kdb

How to I query this table to pick from the symbol list?


I would like to filter out the record that has `1 from the symbol list

Example table:

tab:([]a:((``1`2);`a;b);c:1 2 3);

I tried this:

select from tab where a = `1

also this:

select from tab where `1 in raze a

None of those work.


Solution

  • If you have the table:

    q)tab:([]a:((``1`2);`a;`b);c:1 2 3)
    q)tab
    a     c
    -------
    ``1`2 1
    `a    2
    `b    3
    

    You could use the keyword in combined with each right to remove the desired row:

    q)select from tab where not `1 in/: a
    a c
    ---
    a 2
    b 3