How to avoid duplication in the results of an SQL query?

Just use the SELECT DISTINCT clause between fields.

For Example:

SELECT DISTINCT id, name, surname FROM mytable