I am trying to get filters for the portfolio items listed in the database. As one filter can contain more than one portfolio item, the record duplicates the filters entry in the database.
My Code:
$this->db->distinct();
$this->db->select('filter_id, portfolio_id');
$this->db->where('user_id', $user);
$this->db->join('user_portfolio_filters', 'user_portfolio_filters.id = user_portfolio_relationship.filter_id');
return $this->db->get('user_portfolio_relationship')->result_array();
The filters return fine without the top two lines, however they repeat themselves, how can I only return the filters which have a unique 'filter_id'?
Thank you!