因为你这里有逗号,你看一下,你这里是空的话,那就变成了 select ,,,, date***** from 表,这样肯定报错,你需要判断情况,然后想办法把逗号给处理了······
select
${if(len(fsum)=0,"","fsum,")}
${if(len(d2d)=0,"","d2d,")}
${if(len(fsum_ly)=0,"","fsum_ly,")}
${if(len(dod)=0,"","dod,")}
${if(len(yoy)=0,"","yoy,")}
dates.surdate FROM 表 ,自己吧那几个动态列替换一下,替换成我上面写的这个