首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-09-24 
crystal report的查询公式与oracle 的sql语句要查询 cust_id32 并且 adv_dt是当前日期前一天的记录:cry

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






热点排行