${if(len(col)=0,'T.*',replace(col, '上架率','round(decode(sum(上架率),0,0,sum(上架率)/sum(目标))*100,1) ||'%' AS 上架率'))} 现在拼接出来会报错 此处完整代码如下: ${if(len(col)=0,'T.*', replace(replace(replace(replace(replace(replace( replace(col, '有促门店数','round(sum(有促门店数)) AS 有促门店数'), 'SAB门店数','round(sum(SAB门店数)) AS SAB门店数'), '上架门店数','round(sum(上架门店数)) AS 上架门店数'), '上架率','round(decode(sum(上架率),0,0,sum(上架率)/sum(目标))*100,1) AS 上架率'), '动销门店数','round(sum(动销门店数)) AS 动销门店数'), '动销率','round(decode(sum(动销率),0,0,sum(动销率)/sum(总数))*100,1) AS 动销率'), '无动销','round(sum(无动销)) AS 无动销') )} |