Search code examples
kdb

How can one drop/delete columns from a KDB table in place?


Following the documentation, I tried to do the following:

t:([]a:1 2 3;b:4 5 6;c:`d`e`f) // some input table
`a`b _ t                       // works: delete NOT in place
(enlist `a) _ t                // works: delete NOT in place
t _:`a`b                 // drop columns in place does not work; how to make it to work?
// 'type
//   [0]  t _:`a`b

Thank you very much for your help!


Solution

  • You should be able to use

    delete a,b from `t
    

    to delete in place (The backtick implies in place).

    Alternatively, for more flexibility you could use the functional form;

    ![`t;();0b;`a`b]