查詢所有明細,取到最小時間,如果明細與最小時間相等,為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塊要加()么,哪里不對啊?
uj5u.com熱心網友回復:
ed hh24:mi:ss')這是一句什么???在你的form表后面
uj5u.com熱心網友回復:
(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_outpa轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/86424.html
標籤:非技術區
