读书人

crystal report的查询公式与oracle 的

发布时间: 2012-09-24 13:49:41 作者: rapoo

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}), "通知","修改" )






读书人网 >SQL Server

热点推荐