兩張表 一個ssxx(手術資訊),一個fyxx(費用資訊)
select
bah 病案號,zyid 住院id,zycs 住院次數,ssf 手術上臺費,
max(case when xh='0' then ssczmc else null end ) 第一手術,
max(case when xh='1' then ssczmc else null end ) 第二手術,
max(case when xh='2' then ssczmc else null end ) 第三手術
from (
select
a.bah as bah,a.zyid as zyid,a.zycs as zycs,a.xh as xh,a.ssczmc as ssczmc,b.ssf as ssf
from
HY_VW_BASY_SSXX a LEFT JOIN HY_VW_BASY_FYXX b on a.bah = b.bah and a.zycs = b.zycs
where a.xh in(0,1,2) and b.ssf > 0 and a.ryrq >= to_date(20191205,'yyyy-mm-dd')
)tmp
group by bah,zyid,zycs,ssf

想問一下這個去重陳述句怎么寫
uj5u.com熱心網友回復:
這陳述句group by 之后還有重復么? 是什么樣的貼出來看看轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/184841.html
標籤:開發
上一篇:ORACLE大佬求醫解答
下一篇:免費Oracle資料庫監控軟體
