Please test the below query for your result


select * from out_tab where
plot in (
select t.plot from
(
select min(rowid) rn, plot, gangcode
from out_tab
group by plot, gangcode) t