How to apply max function for each row in KDB?

北慕城南 提交于 2019-12-05 07:21:39

You can try using |

q)update x|0.5 from myTable
Rahul

It should work. It worked for me. This is the query I used for testing:

update x:max(x;0.5) from myTable

-- Check semicolon in max function

Try the kdb vector conditional its similar to case-when in SQL:

q)t:([] a:6?.9)

q)t
a
---------
0.4237094
0.5712045
0.8705158
0.2075746
0.8549775
0.3951729

q)update ?[a<0.5;0.5;a] from t
a
---------
0.5
0.5712045
0.8705158
0.5
0.8549775
0.5
q)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!