select bh,jg from
(
select
bh,lx,jg,rownum() over(partition by bh order by lx) rank
from table
) t
where t.rank=1
(
select
bh,lx,jg,rownum() over(partition by bh order by lx) rank
from table
) t
where t.rank=1
(
select
bh,lx,jg,rownum() over(partition by bh order by decode(lx,'ZA00',1,'Z120',2,'ZA10',3)) rank
from table
) t
where t.rank=1