Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply max function for each row in KDB?

Tags:

kdb

q-lang

I want to ensure all values in column x are no smaller than 0.5, so I do:

update x:max (x 0.5) from myTable

But this gives an error (in Studio For KDB+):

An error occurred during execution of the query.
The server sent the response:
type
Studio Hint: Possibly this error refers to wrong type, e.g `a+1

What's wrong?

like image 622
mchen Avatar asked Apr 14 '14 09:04

mchen


2 Answers

You can try using |

q)update x|0.5 from myTable
like image 196
WooiKent Lee Avatar answered Sep 28 '22 02:09

WooiKent Lee


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

like image 26
Rahul Avatar answered Sep 28 '22 01:09

Rahul