对动态列汇总的值进行排序,这样写的order by 不生效: SELECT ${if(len(col)=0,'*',REPLACE(REPLACE(REPLACE(REPLACE(col,'预算收入','sum(预算收入) as 预算收入'),'预算成本','sum(预算成本) as 预算成本'),'实际收入','sum(实际收入) as 实际收入'),'实际成本','sum(实际成本) as 实际成本') )} FROM TEMP5 ${if(len(col)<1,"","group by "+ REPLACE(REPLACE(REPLACE(REPLACE(col,',预算收入',''),',预算成本',''),',实际收入',''),',实际成本','') )} ${if(len(col)<1,"","order by "+ REPLACE(REPLACE(REPLACE(REPLACE(col,',预算收入',''),',预算成本',''),',实际收入',''),',实际成本','') )} 我想按照实际收入、预算收入排序。。。。 |