Remove duplicate values in a column after join in drupal 7
Can you try with the result you are getting and avoid the duplicates using below codes. 

 $used_tids = array();
 foreach ($result as $row) {
        if (!in_array($row-&gt;tid, $used_tids)) {
          $new_result[] = $row;
          $used_tids[] = $row-&gt;tid;
        }
      }
      // new filtered results after avoiding duplicates
      $results = $new_result;