Search code examples
kdb

KDB Query with upper in where clause


How to use upper() in where clause. Below query is giving error:

http://kdbserver:5001/?select from table where upper(cola) = `ABC

Please suggest how to query

N.B.:Cola is a column

http://kdbserver:5001/?select upper(cola) from table <-- is working fine.

Solution

  • Try upper[cola]='ABC'.

    Round brackets are not used for function arguments, they are used for precedence etc. Square brackets are used in function arguments.

    The reason round brackets worked in the second case is because the parser simply ignored them. Would be the same as select upper cola from table

    In your first case you have effectively done select from table where upper (cola='ABC') rather than select from table where (upper cola)='ABC'.