在写动态参数时,有些字段存在“”号才能查询,如何在if中进行拼接,sql如下 select CUSTOMER,round(SUM("/BIC/ZCXSZJ")/10000 ,2) AS BTR from "SAPABAP1"."/BIC/AZMSD_D012" where comp_code = '${ZVAR_GSDM}' and calyear = '${ZV_CALYEAR_03}' and calmonth2 between '${ZV_0CALMONTH2_01}' and '${VAR_20190621020857}' and "/BIC/ZAUART" IN ('ZCR','ZDR','ZKA','ZKB','ZOR1','ZOR2','ZOR3','ZOR6','ZOR7','ZRE1','ZRE2','ZINS','ZINR') ${if(len(IV_TYPE)=0,"","and /BIC/ZXSFL = '"+IV_TYPE+"'" )} group by CUSTOMER order by SUM("/BIC/ZCXSZJ") desc // /BIC/ZXSFL 的用法需要“/BIC/ZXSFL”才能使用 |
最佳回答 |
||||
0
|
|