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

Viewed 134

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.

2 Answers

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

Hey your tab gives a 'b error so i've swapped b->3

q)tab
a     c
-------
``1`2 1
`a    2
3     3
q)select from tab where max each`1~''a
a    c
------
 1 2 1
q)select from tab where not max each`1~''a
a  c
----
`a 2
3  3

Related