帆软报表常用SQL表达式

您可以键入"${abc}"做为一个参数,这里abc是参数的名称。

例如:

select * from table where id=${abc}

select * from table where id='${abc}' (如果id字段为字符串类型)

除非整个表达式用${}包起来的,变量名不用再次使用${}

例如:

${IF(LEN(orgname)==0,""," and m.org_name ='"+ orgname +"'")}

1.相等号参数,判断是否为空

${IF(LEN(orgname)==0,""," and m.org_name ='"+ orgname +"'")}

2.模糊查询,判断是否为空

${IF(len(keyword)=0, "", " and (m.device_code like '%"+keyword+"%' or m.device_name like '%"+keyword+"%' or m.device_tag_no like '%"+keyword+"%')")}

3.数字不相等号

where d.quality=0 and d.data_source<>0 and p.status<>-1

4.日期

where a.confirm_date>=to_date('${sdate} 00:00:00','yyyy-mm-dd hh24:mi:ss') and a.confirm_date<to_date('${edate} 00:00:00','yyyy-mm-dd hh24:mi:ss')+1

5.日期,判断是否为空

${IF(OR(isnull(sdate),isnull(edate)), "", " and t.sampled_date>=to_date('"+sdate+" 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.sampled_date<to_date('"+edate+" 00:00:00','yyyy-mm-dd hh24:mi:ss')+1 ")}

6.查询列如果为空显示0

select nvl(size,0) as size from t


持续更新..

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值