KDB:与表的字符串比较 [英] KDB: String comparison with a table

查看:60
本文介绍了KDB:与表的字符串比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子bb:

bb:([]key1: 0 1 2 1 7; col1: 1 2 3 4 5; col2: 5 4 3 2 1; col3:("11";"22" ;"33" ;"44"; "55"))

如何进行字符串的关系比较?假设我想获取col3小于或等于"33"的记录

How do I do a relational comparison of string? Say I want to get records with col3 less than or equal to "33"

select from bb where col3 <= "33"

预期结果:

key1    col1    col2    col3
0       1       5       11
1       2       4       22
2       3       3       33

推荐答案

如果您希望col3保持字符串类型,那么只是在qsql查询中临时转换?

If you want col3 to remain of string type, then just cast temporarily within the qsql query?

q)select from bb where ("J"$col3) <= 33
key1 col1 col2 col3
-------------------
0    1    5    "11"
1    2    4    "22"
2    3    3    "33"

这篇关于KDB:与表的字符串比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆