KDB选择x在其他查询结果中的位置

KDB选择x在其他查询结果中的位置,kdb,Kdb,我有一个问题 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] 但这会产生一张空桌子。对此有何建议?中的第二个参数需要为列表类型,因此您可以执行以下操作: s

我有一个问题

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]
但这会产生一张空桌子。对此有何建议?

中的第二个参数需要为列表类型,因此您可以执行以下操作:

select from table where Name in exec Name from top
或:

你也可以从一开始就把它列在榜首。使用运算符获取排序表中的前10项:

top:10#(exec Name from `Val xdesc select sum Val by Name from table)
然后你就能做到:

select from table where Name in top
要输入的第二个参数必须是列表类型,因此您可以执行以下操作:

select from table where Name in exec Name from top
或:

你也可以从一开始就把它列在榜首。使用运算符获取排序表中的前10项:

top:10#(exec Name from `Val xdesc select sum Val by Name from table)
然后你就能做到:

select from table where Name in top

工作完美。你能解释一下它是怎么工作的吗?找不到太多关于此的文档,请使用kx文档的链接进行编辑。是take操作符;在本例中,10从已排序的tableWorks中提取前10项。你能解释一下它是怎么工作的吗?找不到太多关于此的文档,请使用kx文档的链接进行编辑。是take操作符;在本例中,10从排序表中获取前10项