传送门002

(select nvl(max(sfth),0) sfth from wz_jhdwz_tb z where z.jhdn_bm = t.JHDN_BM and z.sfth =1 ) sfth

select wzms_bm, --cghtd_qdrq,hsdj,
max(hsdj) keep( dense_rank first order by cghtd_qdrq desc ) hsdj --over(partition by wzms_bm )
from (
select b.cghtd_qdrq, a.cghtd_bm, a.wzms_bm, a.hsdj, a.ydpjj
from wz_cghtdwz_tb a, wz_cghtd_tb b
where a.cghtd_bm = b.cghtd_bm )
group by wzms_bm

转载于:https://www.cnblogs.com/methane712/p/11127558.html

你可能感兴趣的:(传送门002)