可以使用 interval 填充达到上述效果,代码如下:
t = table(`35412`35412`35412 as indCode, `H30356.SH`H30356.SH`H30356.SH as indexCode, `000001.SZ`000001.SZ`000001.SZ as code, 2014.06.30 2014.09.30 2014.12.31 as date, 0.0168 0.0153 0.0158 as weight, 1111111111 2222222222 3333333333 as totalMV, 0.0015 0.0013 0.0009 as pholding, 1 1 1 as jr) tmp = select indCode,indexCode,code,date,weight,totalMV,pholding,jr from t group by interval(date,1d,'prev') as date // 去除非交易日数据 res = select * from tmp where date in getMarketCalendar("CFFEX")