KDB select where x in other query result
KDB select where x in other query result
我有一个问题
top:flip select [10] Name from `Val xdesc select sum Val by Name from table
我想根据该结果进行另一个查询过滤
select from table where Name in top
但是这给了我一个类型错误。我也试过
select from table where {x in y}[Name; top]
但这会产生一个空 table。有什么建议可以做到这一点吗?
in
的第二个参数需要是列表类型,所以你可以这样做:
select from table where Name in exec Name from top
或:
select from table where Name in top[`Name]
您还可以制作 top
列表作为开头。使用 take 运算符获取已排序 table:
中的前 10 个项目
top:10#(exec Name from `Val xdesc select sum Val by Name from table)
然后你就可以做到:
select from table where Name in top
我有一个问题
top:flip select [10] Name from `Val xdesc select sum Val by Name from table
我想根据该结果进行另一个查询过滤
select from table where Name in top
但是这给了我一个类型错误。我也试过
select from table where {x in y}[Name; top]
但这会产生一个空 table。有什么建议可以做到这一点吗?
in
的第二个参数需要是列表类型,所以你可以这样做:
select from table where Name in exec Name from top
或:
select from table where Name in top[`Name]
您还可以制作 top
列表作为开头。使用 take 运算符获取已排序 table:
top:10#(exec Name from `Val xdesc select sum Val by Name from table)
然后你就可以做到:
select from table where Name in top