adding distinct to query