select zyid,zdmc from
(
select ROW_NUMBER() OVER(PARTITION BY zyid ORDER BY zdrq DESC) xh, zyid,zdmc from JK_HIS_BRZDXXB_CRB where zdlxmc !='出院诊断'
)a where xh=1
select zyid,zdmc from
(
select ROW_NUMBER() OVER(PARTITION BY zyid ORDER BY zdrq DESC) xh, zyid,zdmc from JK_HIS_BRZDXXB_CRB where zdlxmc !='出院诊断'
)a where xh=1