Select data from database
You try code

$term_id = 1;
  $query = $this-&gt;connection-&gt;select('node', 'node');
  $query-&gt;join('node__field_country', "nfc", "node.nid=nfc.entity_id and (nfc.field_country_target_id=1 or nfc.field_country_target_id=2 or nfc.field_country_target_id=3)");
  $query-&gt;join('taxonomy_index', "tid", "tid.nid = node.nid AND tid.tid =".$term_id." AND tid.status = 1 ");
  $query-&gt;execute()-&gt;fetchField();