title: T-SQL error with STUFF((SELECT......)) function in SQL Server CE
body: <p>Using SQL Server CE in Visual Studio 2008, I try to query a database like this:</p>
  
  <pre><code>select          
     [INTESTAZIONE Ente], 
     [INTESTAZIONE Tipo],
     [INTESTAZIONE Anno], 
     [INTESTAZIONE Protocollo], 
     COUNT([Mittenti Mittente]) AS [N.MITTENTI],
     [Mittenti Mittente] AS [MITTENTI],
     STUFF(
             (SELECT ',' + [Mittenti Mittente] AS [ELENCO MITTENTI]
              FROM ElencoMittenti
              WHERE [ElencoMittenti.[Mittenti  Mittente]] = [Elenco_Ricorsi.[Mittenti Mittente]]
              FOR XML PATH('')), 1, 1, '' ) AS [RISULTATO]
  from    
     Elenco_Ricorsi
  group by 
     [INTESTAZIONE Ente], [INTESTAZIONE Tipo],[INTESTAZIONE Anno], 
     [INTESTAZIONE Protocollo], [Mittenti Mittente]
  </code></pre>
  
  <p>I need the <code>STUFF((SELECT.....)</code> command to build an array a result of this query.</p>
  
  <p>This query gives an error: </p>
  
  <blockquote>
    <p><em>token in error = SELECT" and the problem comes from the nested
    'select'</em></p>
  </blockquote>
  
  <p>I have read this is possible to do also with SQL Server Compact Edition, so I think I have made some error in query.</p>