Search code examples
kdbqsqlquery

Kdb - selecting by column where the symbol is two words


I have a table with a column "counterparty". The datatype is a symbol. however there is two separate words in the format of: "enlist`XXX XXX" I am selecting where counterpart = XXX XXX. Any ideas on how to do this?

thanks


Solution

  • It might be worth using an each-right iterator with in, assuming I've understood you right.

    q)t: ([] a: 1 2; b: (enlist `$"xx xxxx"; (`$"xxxx xxxx"; `$"xxxx xxxx")))
    q)t
    a b                   
    ----------------------
    1 ,`xx xxxx           
    2 `xxxx xxxx`xxxx xxxx
    q)select from t where (`$"xx xxxx") in/: b
    a b      
    ---------
    1 xx xxxx