title: golang slice in mysql query with where in clause
body: <p>I am running the below query, but only get the first id value:-</p>
  <pre><code>select * from `table` where table`.`id` in ('1', '2', '3', '4', '5', '6', '7', '9', '11', '13', '14', '15', '17') and `table`.`deleted_at` is null
  </code></pre>
  <p>I have done the following:-</p>
  <pre><code>var aID = make([]string, 0)
  var in India // india is struct
  
  for rows.Next() {
      cook := rows.Scan(&amp;in.ID)
  
      aID = append(aID, strconv.Itoa(in.ID))
  }
  
  asID = strings.Join(aID, &quot;,&quot;)
  
  anotherRow,err := db.Query(&quot;SELECT * from table2 where id in (?)&quot;, asID)
  if err != nil { fmt.Printf(&quot;Error: &quot;, err) }
  // ... Other line follows up with &quot;for anotherRow.Next() and fetching&quot;
  </code></pre>
  <p>While fetching data, it only returns value of &quot;1&quot; and ignores all other ID passed to it, which are <code>'2', '3', '4', '5', '6', '7', '9', '11', '13', '14', '15', '17'</code>.</p>
  <p>How can I pass it correctly?</p>
  <p>I am using <code>go-sql-driver/mysql</code>.</p>
  <p>FAQ :</p>
  <ol>
  <li><p><code>aID</code> does contain all those numbers as string and</p>
  </li>
  <li><p>table has all the rows available with provided above <code>id</code>.</p>
  </li>
  <li><p><code>table</code> is from where <code>id</code> is fetched and appended to <code>aID</code> and another record with <code>id</code> stored in <code>aID</code> are fetched with <code>in</code> statement from <code>table2</code>.</p>
  </li>
  </ol>
  <p>Thanks</p>