sql写法问题

${IF(pRESOURCE_TYPE = '现存已配车',"

select 

calculation_method,

car_series,

car_model,

sum(allocation_predict_qty) as qty

from 

dal.dal_dvmp_delivery_forecast_fr

where

 calculation_method in ('"+pd+"')

"group by car_series,calculation_method,

car_model

 ",

"select 

car_series,

car_model,

sum(allocation_predict_qty) as qty

from

dal.dal_dvmp_delivery_forecast_fr

group by car_series,

car_model

"

)}

,请问这个怎么嵌套参数为空选择全部

例如

${if(len(pMETHOD) == 0,"","and calculation_method  IN ('" +pMETHOD + "')")}

FineReport Leonard.Lin 发布于 2021-12-30 14:30
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
snrtuemcLv8专家互助
发布于2021-12-30 14:33(编辑于 2021-12-30 14:33)

${IF(pRESOURCE_TYPE = '现存已配车',"

select 

calculation_method,

car_series,

car_model,

sum(allocation_predict_qty) as qty

from 

dal.dal_dvmp_delivery_forecast_fr

where 1=1 "

+if(len(pMETHOD) == 0,"","and calculation_method  IN ('" +pMETHOD + "')")+

"group by car_series,calculation_method,

car_model",

"select 

car_series,

car_model,

sum(allocation_predict_qty) as qty

from

dal.dal_dvmp_delivery_forecast_fr

group by car_series,

car_model

"

)}

  • Leonard.Lin Leonard.Lin(提问者) 如果在加一个${if(len(pPOINT) == 0,\"\",\"and car_contract_use_node IN (\'\" +pPOINT + \"\')\")},应该咋写!
    2021-12-30 14:37 
  • Leonard.Lin Leonard.Lin(提问者) 直接复制之前的就可以了是吧
    2021-12-30 14:37 
  • snrtuemc snrtuemc 回复 Leonard.Lin(提问者) 我给你加进去了啊,注意把${}去掉
    2021-12-30 14:38 
  • 2关注人数
  • 333浏览人数
  • 最后回答于:2021-12-30 14:33
    请选择关闭问题的原因
    确定 取消
    返回顶部