title: Sheets query SQL "in" -like function
body: <p>I hava a table with some data in a google sheet:</p>
  
  <pre><code>[Name] [Product] [Price] [ID]
  </code></pre>
  
  <p>I need to collect and sum selected row based on an other range, say <code>A2:A</code> on an other sheet, where <code>A2:A</code> contains names from <code>[Name]</code>.</p>
  
  <p>I am trying the following solution:</p>
  
  <pre><code>=query('dataSheet'!A3:D,"select * " &amp; myFunction() ,-1)
  </code></pre>
  
  <p>where <code>myFunction()</code> is a script to assamble the "where ... or where ... " part of the SQL query:</p>
  
  <pre><code>function myFucntion(){
    var payList = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Ügyfél Fizetés').getRange('A2:A').getValues();
    var payLength = payList.filter(String).length;
    var payRow = payLength + 2;
    if (payLength &gt; 0){
      var sqlString = "";
      sqlString = "where A = '""" &amp; " &amp; """ &amp; "A " &amp; payRow &amp; """ &amp; """ &amp; "'";
      for (i = 0; i &lt; payLength; i++){
  
      }
    }
    Logger.log(sqlString);
    return sqlString;
  }
  </code></pre>
  
  <p>The <code>sqlString</code> should look something like this:</p>
  
  <pre><code>where A = '" &amp; A2 &amp; "' or A = '" &amp; A3 &amp; "'"
  </code></pre>
  
  <p>I will add the <code>or</code> segments in the <code>for</code> loop, but the <code>sqlString = ...</code> part throws an error:</p>
  
  <blockquote>
    <p>Missing ; before statement.</p>
  </blockquote>
  
  <p>Help me with the syntax, or if you have more efficient solution for my problem, I'm open to all suggestions.</p>