Prova con:

Codice PHP:
$query "SELECT DISTINCT ..."