--查询 唯一的encasement_no数据
select se.volume
from ECC_EPM.ECC_EQ_SEND_ENCASEMENT se
where se.enable_flag = 'T'
--and se.send_form_id = 184149
and se.oid in (select max(e.oid)
from ECC_EPM.ECC_EQ_SEND_ENCASEMENT e
where e.enable_flag = 'T'
and e.send_form_id = 36440
group by e.send_form_id,e.encasement_no)
--统计去重后encasement_no个数
select count(distinct e.encasement_no), e.send_form_id--,e.encasement_no
from ECC_EPM.ECC_EQ_SEND_ENCASEMENT e
where 1 = 1
and e.enable_flag = 'T'
and e.send_form_id = 36440
--having count(1)>1
group by e.send_form_id--,e.encasement_no
select e.oid, e.encasement_no
from ECC_EPM.ECC_EQ_SEND_ENCASEMENT e
where 1 = 1
and e.enable_flag = 'T'
and e.send_form_id = 36440
having e.oid = max(e.oid)
group by e.oid,e.encasement_no