..and if you just want the idcodes change the first line to:
select distinct idcode from table