select distinct to avoid duplicates on joins #3322