单列汇总可以以下实现
SELECT ${if(len(col)=0,'*',replace(col,'申请桌数','sum(申请桌数)'))} FROM A
${if(len(col)<=1,"","group by "+replace(replace(col,',申请桌数',''),'申请桌数','rn'))}
如果要在加一个申请金额,该如何修改语句?
解决动态列的分组统计问题-https://help.finereport.com/doc-view-1845.html
按照我的语句试一下,有两个汇总替换两次
SELECT ${if(len(col)=0,'*',replace(replace(col,'申请桌数','sum(申请桌数)')),'申请金额','sum(申请金额)')} FROM A
${if(len(col)<=1,"","group by "+replace(replace(col,',申请桌数',''),'申请金额',''))}
动态分组-https://help.finereport.com/doc-view-2062.html