prova con group by
codice:
select CAP from  TB_CAP 
goup by CAP
order by CAP