se vuoi implementare una funzione simile a distinct dell'sql prova a vedere qui
http://tinyurl.com/7e4bj