title: Select exists not working wordpress
body: <p>Hello stackoverflow community. I need help. I've got list of cities which belongs to companies. When i filter companies by category, i want to delete cities of companies if there are no company with that city. So I thought that i need to check if there are companies with that category and city. So I've tried:</p>
  
  <pre><code>$querystr = "
      SELECT EXISTS(SELECT * FROM $wpdb-&gt;term_relationships, $wpdb-&gt;postmeta
      WHERE $wpdb-&gt;term_relationships.object_id = $wpdb-&gt;postmeta.post_id  
      AND $wpdb-&gt;postmeta.meta_key = 'country'
      AND $wpdb-&gt;postmeta.meta_value = '$country_name'
      AND $wpdb-&gt;postmeta.meta_key = 'city'
      AND $wpdb-&gt;postmeta.meta_value = '$city_name
      AND $wpdb-&gt;term_relationships.term_id = '$company_category'')
   ";
   $pageposts = $wpdb-&gt;get_results($querystr);
  </code></pre>
  
  <p>But that doesnt work, can you help me? :/</p>