【问题标题】:Extracting data from a table in kdb从 kdb 中的表中提取数据
【发布时间】:2021-02-19 20:03:12
【问题描述】:

Kdb 问题: 它们是表中的多行,如果列满足条件,我想检查所有行是否。 所以专栏StartDay = *** 如何检查该列的每一行?

Select from t where StartDay = '$"***" 

只是给我输入错误。

任何帮助将不胜感激!

【问题讨论】:

  • 请注意语法和标点符号。没有这些,你很难阅读!

标签: kdb


【解决方案1】:

假设列StartDay 是日期类型,如下例所示

q)show t:([]StartDay:.z.d+til 3;number:til 3;sym:`abc`def`ghi)
StartDay   number sym
---------------------
2021.02.19 0      abc
2021.02.20 1      def
2021.02.21 2      ghi

那么下面的查询就会起作用

q)select from t where StartDay=2021.02.19
StartDay   number sym
---------------------
2021.02.19 0      abc

您给出的示例似乎您正在尝试查询符号类型的列。这里有两个例子

q)select from t where sym=`$"ghi"
StartDay   number sym
---------------------
2021.02.21 2      ghi

q)select from t where sym=`ghi
StartDay   number sym
---------------------
2021.02.21 2      ghi

也许where in q-sql 上的以下指南会有所帮助。

【讨论】:

  • 感谢 Thomas 最后让它工作了。我一直在查询字符串列表,最终转换了列,我可以使用查询; q) 从 t 中选择不是 StartDay ='$"***"
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-01
  • 2015-02-03
  • 2020-05-05
  • 1970-01-01
相关资源
最近更新 更多