title: Optimized query for IN operator with multiple columns
body: <p>I have following table structure </p>
  
  <pre><code>batch_id    id  value
  877         10  ABC
  877         41  XYZ
  877         23  VPN
  855         10  ABC
  866         41  XYZ
  </code></pre>
  
  <p>I want batch id for which following both conditions are true
  id = 10 and value = ABC
  id = 41 and value = XYZ</p>
  
  <p>In above example I want 877 as output.</p>
  
  <p>I have written query like:</p>
  
  <pre><code>SELECT final_table.id
  FROM
  (
      select C.value , C.id
      FROM C
      WHERE (C.id, C.value) IN ((10, 'ABC'), (41, 'XYZ'))
  ) AS final_table
  GROUP BY final_table .id
  HAVING COUNT(final_table .id) &gt; 1
  </code></pre>
  
  <p>As I don't have too much knowledge of sql please suggest is this correct?</p>
  
  <p>Thanks in advance.</p>