查询所有明细,取到最小时间,如果明细与最小时间相等,为1,不等,为0。
select decode(e.Recipeflag_Int,(select count(*) from t_opr_outpatientrecipe a where a.recorddate_dat between to_date('2017-08-03 00:00:00','yyyy-mm-dd hh24:mi:ss')and to_date('2017-08-03 23:59:59','yyyy-mm-dd hh24:mi:ss')and a.recorddate_dat=(select min(recorddate_dat) from t_opr_outpatientrecipe where a.registerid_chr=registerid_chr)=1),1,0)from t_opr_outpatientrecipe ed hh24:mi:ss')and to_date('2017-08-03 23:59:59','yyyy-mm-dd hh24:mi:ss')and a.recorddate_dat=(select min(recorddate_dat) from t_opr_outpatientrecipe where a.registerid_chr=registerid_chr)=1),1,0)from t_opr_outpatientrecipe e一直提示缺失右括号......网上不是说decode里面的select块要加()么,哪里不对啊?
select decode(e.Recipeflag_Int,(select count(*) from t_opr_outpatientrecipe a where a.recorddate_dat between to_date('2017-08-03 00:00:00','yyyy-mm-dd hh24:mi:ss')and to_date('2017-08-03 23:59:59','yyyy-mm-dd hh24:mi:ss')and a.recorddate_dat=(select min(recorddate_dat) from t_opr_outpatientrecipe where a.registerid_chr=registerid_chr)=1),1,0)from t_opr_outpatientrecipe ed hh24:mi:ss')and to_date('2017-08-03 23:59:59','yyyy-mm-dd hh24:mi:ss')and a.recorddate_dat=(select min(recorddate_dat) from t_opr_outpatientrecipe where a.registerid_chr=registerid_chr)=1),1,0)from t_opr_outpatientrecipe e一直提示缺失右括号......网上不是说decode里面的select块要加()么,哪里不对啊?
解决方案 »
- oracle合并数据
- 新手求教分割数据插入的问题
- oracle的子查询里不让有order by 有什么好的解决办法么,我先说一下我的需求。。。。。
- 为什么超链接设置了取消下划线,可以去还会出现下划线
- 菜鸟问题
- 不会dbms_output.put_line
- 向各位大侠请问一段procedure code 里的几个code的意思!
- PL/SQL和Java开发Oracle8i应用程序
- 急!求教高手关于linux下 oracle10g rac双实例无法同时启用的问题!!!
- PL/SQL Developer 的select 问题
- oracle 更新varchar2字段为"" 出现乱码
- Oracle 11G临时表空间
这是一句什么???在你的form表后面