How do I select specific records if i only put one symbol in filter?
Eg:
tab:([]a:1 2 3;b:(`abc`bde;`efg`rte;`dqw`gds))
1 (`abc`bde)
2 (`efg`rte)
3 (`dqw`gds)
I want to filter on abc
so only return:
1 (`abc`bde)
select from tab where b=`abc
will not work.
You can use the each-right adverb /:
with the in
function:
q)select from tab where `abc in/: b
a b
---------
1 abc bde
Each-right is necessary here because table columns are vectors; so in
is operating on a nested list of symbols. The exec
call below shows this more clearly:
q)0N!(exec b from tab);
(`abc`bde;`efg`rte;`dqw`gds)