title: How to use string_agg in SQL in Excel Query
body: <p>I know that in SQL I can use the 'String_agg(Test1, ',')' function for grouping rows and concatenate values in a selected field ('Test1' in this case).</p>
  
  <p>For Example:</p>
  
  <p>I have a query that the result without using String_agg on 'Buyer' field is:</p>
  
  <pre><code>**Key** | **Buyer** | **MP**
  1 | Josh | Gregory
  1 | Bred | Gregory
  2 | John | Ethan
  </code></pre>
  
  <p>The expected results when using String_agg is:</p>
  
  <pre><code>**Key** | **Buyer** | **MP**
  1 | Josh, Bred | Gregory
  2 | John | Ethan
  </code></pre>
  
  <p>But the problem is that I'm trying to execute it in SQL query which retrieves data to Excel file from another Excel file and it fails because of an error that seems like the Excel query doesn't know the String_agg function.</p>
  
  <p>The query is:</p>
  
  <pre><code>SELECT `Sheet1$`.Key, string_agg(`Sheet1$`.Buyer, `, `) AS `Buyer`, `Sheet1$`.MP
  FROM `C:\Input\Data.xls`.`Sheet1$` `Sheet1$`
  GROUP BY 2
  ORDER BY `Sheet1$`.Key
  </code></pre>
  
  <p>Screenshot:</p>
  
  <p><a href="http://i.stack.imgur.com/ILu2S.png" rel="nofollow">Query screenshot</a></p>
  
  <p>Error:</p>
  
  <p><a href="http://i.stack.imgur.com/PmCTy.png" rel="nofollow">Error Screenshot</a></p>
  
  <p>Someone can help me and tell me how should I correct my query to make it works?</p>
  
  <p>Thank you!</p>