add DISTINCT when selecting via join table

Hi, I think this is a fix for the issue I found here:
https://gist.github.com/levity/02052edd445b68174c1e

But I've only just started using this library today, so I might be overlooking something important.