title: Equivalent of MSSQL's STUFF and XML PATH in MYSQL
body: <p>I have an mssql database that I want to convert/migrate to mysql. </p>
  
  <p>I am getting the error message below.</p>
  
  <pre><code>Error Number: 1064
  
  You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') FROM (SELECT a3t' at line 10
  
  SELECT DISTINCT task_id, members = STUFF(( SELECT N', ' + t.Ful FROM (SELECT teamAlpha.task_id, ( users.firstname   + ' ' + users.lastname ) as Ful FROM teamAlpha JOIN users ON users.user_id = teamAlpha.user_id ) t WHERE t.task_id = u.task_id FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') FROM (SELECT teamAlpha.task_id, ( users.firstname + ' ' + users.lastname ) as Ful FROM teamAlpha JOIN users ON users.user_id = teamAlpha.user_id ) u      
  </code></pre>
  
  <p>Here's the code:</p>
  
  <pre><code>    $query = $this-&gt;db-&gt;query("
   SELECT DISTINCT
   task_id,
   members = STUFF((
        SELECT N', ' + t.Ful
        FROM (SELECT teamAlpha.task_id,
                       ( users.firstname  + ' ' + users.lastname ) as Ful
                  FROM  teamAlpha
                  JOIN users ON users.user_id = teamAlpha.user_id ) t
        WHERE t.task_id = u.task_id   
        FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '')
  FROM 
  (SELECT teamAlpha.task_id,
           ( users.firstname  + ' ' + users.lastname ) as Ful
      FROM  teamAlpha
      JOIN users ON users.user_id = teamAlpha.user_id ) u");
  
      return $query-&gt;result();
  </code></pre>
  
  <p>What is the equivalent of mssql's STUFF() and XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '' in mysql? Thank you very much for the help.</p>