PL/SQL中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 e
这个语句,查询明细中的信息,找到时间最早的那一个,再跟明细对比如果结果为1,就显示1,结果不为1,显示0.