将值列表传递给 kdb 中的嵌套函数

问题描述 投票:0回答:1

功能:

.terry.func:{
 tab:([]`a`b`c;b:1 2 3;c:`MSFT`GLE`APPLE);
 list:((`a,'1);(`b,'2));
 .terry.func2:{[t;x;y]select from t where a = x,b = y} [tab;;] each list;
 :.terry.func2
 }

我实际上将从另一个表中提取列表,并通过 ,' 连接起来

但是,我不知道如何让这个功能发挥作用

kdb
1个回答
0
投票

这可能就是您所追求的:

.terry.func:{
 tab:([] a:`a`b`c;b:1 2 3;c:`MSFT`GLE`APPLE);
 list:((`a;1);(`b;2));
 {[t;x;y]select from t where a = x,b = y}[tab](.)/:list
  };
q)raze .terry.func[]
a b c   
--------
a 1 MSFT
b 2 GLE 

© www.soinside.com 2019 - 2024. All rights reserved.