issue97, add missing DISTINCT keyword to SQL query