可以使用DolphinDB的元编程功能实现上述需求,元编程教程链接:https://gitee.com/dolphindb/Tutorials_CN/blob/master/meta_programming.md
可以参考以下写法:
name1 = `avgPrice name2 = `sumVol whereConditions = [<symbol=`MSFT>,<volume>x>] sql(select=(sqlColAlias(<avg(price)>, name1), sqlColAlias(<sum(volume)>, name2)), from=t1, groupBy=sqlCol(`date)).eval()
返回结果如下