KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Trying to use each right

  • Trying to use each right

    Posted by ekallivrousis on December 6, 2021 at 12:00 am
    t:([x:(1 2 3);y:(`x`y`z)]z:"abc") 
    
    l:`x`y`z!(2;`y;"b") 
    
    select from t where (2#l) ~/:flip value flip key t

    Shouldnt the above code be showing the second row in table? instead i get nothing back.

    ekallivrousis replied 3 months, 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • matt_moore

    Member
    December 6, 2021 at 12:00 am

    Take a look at what each part of the where clause looks like:

    // this is a dictionary 
    q)2#l x| 2 y| `y 
    // and this is a nested list of your x and y columns with no rows matching above 
    q)flip value flip key t 1 `x 2 `y 3 `z

    To correct, just key t

    q)select from t where (2#l) ~/: key t 
    x y| z 
    ---| - 
    2 y| b

     

  • ekallivrousis

    Member
    December 7, 2021 at 12:00 am

    Thank you! this worked

Log in to reply.