delete from tbndfuture
where rowid not in
(
select max(rowid) from tbndfuture group by i_code having count(*)>1
union
select max(rowid) from tbndfuture group by i_code having count(*)=1
)