title: Mysql query syntax error on Windows, works on Linux
body: <p>I have problem with query in <code>mysql</code>. I'm writing web application in Laravel and needed to write raw query for my data. The query is </p>
  
  <pre class="lang-sql prettyprint-override"><code>WITH sorted_messages AS (
          SELECT 
              IF(user_from = 3, user_to, user_from) AS other_user, 
              content, 
              created_at,
              ROW_NUMBER() OVER (PARTITION BY other_user ORDER BY created_at DESC) AS rn
          FROM messages AS m
          WHERE user_from = 3 OR user_to = 3
      )
      SELECT 
          name, 
          p.image_url as image_url, 
          users.id, 
          content, 
          sm.created_at
      FROM 
          users LEFT JOIN sorted_messages AS sm ON users.id = other_user
          LEFT JOIN profiles AS p ON users.id = p.user_id
      WHERE (rn = 1 OR rn IS NULL) AND users.id != 3
      ORDER BY created_at DESC
      LIMIT 10
  
  </code></pre>
  
  <p>I made sure <code>mysql</code> <code>ONLY_FULL_GROUP_BY</code> mode is disabled. I changed my <code>config/database.php</code> to have this under <code>'mysql'</code>:</p>
  
  <pre class="lang-php prettyprint-override"><code>'modes' =&gt; [
                  "STRICT_TRANS_TABLES",
                  "NO_ZERO_IN_DATE",
                  "NO_ZERO_DATE",
                  "ERROR_FOR_DIVISION_BY_ZERO",
                  "NO_AUTO_CREATE_USER",
                  "NO_ENGINE_SUBSTITUTION",
              ],
  </code></pre>
  
  <p>When I run this on Linux it works, but on Windows it doesn't. Response is</p>
  
  <pre><code>Illuminate\Database\QueryException: SQLSTATE[42000]: 
  Syntax error or access violation: 1064 You have an error in your SQL syntax;
  check the manual that corresponds to your MySQL server version for the right
  syntax to use near &amp;#039;sorted_messages AS (
  </code></pre>
  
  <p>I tried manually disabling <code>ONLY_FULL_GROUP_BY</code> mode in <code>mysql</code> settings, but it didn't help.</p>