title: Incorrect syntax near the keyword 'FOR', while the same code worked in a guide
body: <p>I'm trying to roll up multiple rows into one with FOR XML PATH. I'm not sure why I got the error "Incorrect syntax near the keyword 'FOR'"</p>
  
  <p>I was following this guide: <a href="https://www.mssqltips.com/sqlservertip/2914/rolling-up-multiple-rows-into-a-single-row-and-column-for-sql-server-data/" rel="nofollow noreferrer">https://www.mssqltips.com/sqlservertip/2914/rolling-up-multiple-rows-into-a-single-row-and-column-for-sql-server-data/</a></p>
  
  <pre><code>SELECT
      movie.name, movie.date, movie.filelocation, 
      movie.imdb, movie.description,
      STUFF ((SELECT ';' + genre.name 
              FROM genre
              WHERE genre.id = mov_genr.gen_id 
                AND movie.id = mov_genr.mov_id
              FOR XML PATH ('')), 1, 1, '') [genres]
  FROM 
      movie
  FULL JOIN 
      mov_genr on movie.id = mov_genr.mov_id
  FULL JOIN 
      genre on mov_genr.gen_id = genre.id
  </code></pre>
  
  <p>I have 3 tables, <code>movie</code> with a bunch of movies, <code>mov_genr</code> which is a table that connects movies with genres, and <code>genre</code> table, which contains the genres.</p>
  
  <p>I want a query that shows me all the movies and all the genres for those movies but don't duplicate the movie rows and just shows the genres as 1 connected string.</p>