title: How to query from SQL comparing with array members?
body: <p>So I have an array containing computer names called <code>hostnames[]</code>.</p>
  
  <p>Contains: <code>compname1, compname2, compname3</code> etc.</p>
  
  <p>Actually it gets it's members from another SQL query.</p>
  
  <p>I have a data table and I need to query all rows where hostname column has any of the computer names in my array.</p>
  
  <p>something like:</p>
  
  <pre><code>select * from table where hostname in hostnames[]
  </code></pre>
  
  <p>How should I proceed to achieve my goal?</p>
  
  <p>EDIT:
  I was thinking on the below:</p>
  
  <pre><code>string temp = "'" + hostnames[0] + "'";
  for(int i=1; i&lt;hostnames[].Lenght; i++)
  {
  temp = temp + ",'" + hostnames[i] + "'";
  }
  string query = "SELECT * FROM table WHERE hostname IN (" + temp + ")";
  </code></pre>