Search code examples
kdb

How can I select with column of lists


Say I have a table with a column of lists

q)t:([]x:10?1.;y:10?`a`b`c;z:10#enlist`a`b)
q)t
x          y z  
----------------
0.1627662  b a b
0.6884756  b a b
0.8177547  a a b
0.7520102  b a b
0.1086824  c a b
0.9598964  c a b
0.03668341 a a b
0.6430982  a a b
0.6708738  b a b
0.6789082  a a b

How can I select for rows where y in z ?


Solution

  • select from t where y in'z

    As z is a list of lists, you require an each. The ' acts as each-both. http://code.kx.com/q4m3/6_Functions/#672-each-both for more detail. Beware whitespace. https://groups.google.com/forum/#!forum/personal-kdbplus for more knowledgable advice.