当前位置: 代码迷 >> SQL >> crystal report的查询公式与oracle 的sql话语
  详细解决方案

crystal report的查询公式与oracle 的sql话语

热度:24   发布时间:2016-05-05 13:28:44.0
crystal report的查询公式与oracle 的sql语句
要查询 cust_id='32' 并且 adv_dt是当前日期前一天的记录:
crystal report 的公式查询写法为:
{?CUST_ID}={EX_MASTER.CUST_ID} and
{EX_MASTER.ADV_DT}=CurrentDate-1

CurrentDate的单位就是1天。

oracle 的查询语句
select * from ex_master t
where CUST_ID='32' and
to_char((ADV_DT),'yyyy') = (select to_char(sysdate,'yyyy') from dual) and
to_char((ADV_DT),'mm') = (select to_char(sysdate,'mm') from dual) and
to_char((ADV_DT),'dd') = (select to_char(sysdate,'dd') from dual)-1

修改adv_dt字段的值,该字段为date类型:
update ex_master set ADV_DT = to_date('20110221','yyyy/mm/dd') where lc_no='12345'

IIF (IsNull ({EXLC_MASTER.ADV_AMD_DT}), "通知","修改" )






  相关解决方案