Home › Forums › kdb+ › How can I apply a function with ‘if’ to a table? › Re: How can I apply a function with ‘if’ to a table?
-
You can also forgo any conditional statements in this case:
q)update r:p1*p2*not p1=neg p2 from t1 TimeStamp stock p1 p2 r ------------------------ 2018.01.01 AAPL 1 -1 0 2018.01.01 AAPL 2 1 2 2018.01.02 GOOGL -2 2 0 2018.01.02 GOOGL 3 0 0