<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="window-function-restrictions">
      </a>
      14.20.5 Window Function Restrictions
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045191730624">
  </a>
  <a class="indexterm" name="idm46045191729136">
  </a>
  <p>
   The SQL standard imposes a constraint on window functions that
        they cannot be used in
   <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
    <code class="literal">
     UPDATE
    </code>
   </a>
   or
   <a class="link" href="delete.html" title="15.2.2 DELETE Statement">
    <code class="literal">
     DELETE
    </code>
   </a>
   statements to update rows.
        Using such functions in a subquery of these statements (to
        select rows) is permitted.
  </p>
  <p>
   MySQL does not support these window function features:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       DISTINCT
      </code>
      syntax for aggregate window
            functions.
     </p>
    </li>
    <li class="listitem">
     <p>
      Nested window functions.
     </p>
    </li>
    <li class="listitem">
     <p>
      Dynamic frame endpoints that depend on the value of the
            current row.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The parser recognizes these window constructs which nevertheless
        are not supported:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The
      <code class="literal">
       GROUPS
      </code>
      frame units specifier is
            parsed, but produces an error. Only
      <code class="literal">
       ROWS
      </code>
      and
      <code class="literal">
       RANGE
      </code>
      are supported.
     </p>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       EXCLUDE
      </code>
      clause for frame
            specification is parsed, but produces an error.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       IGNORE NULLS
      </code>
      is parsed, but produces an
            error. Only
      <code class="literal">
       RESPECT NULLS
      </code>
      is supported.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       FROM LAST
      </code>
      is parsed, but produces an
            error. Only
      <code class="literal">
       FROM FIRST
      </code>
      is supported.
     </p>
    </li>
   </ul>
  </div>
  <p>
   A maximum of 127 windows is supported for a given
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT
    </code>
   </a>
   . Note that a single query
        may use multiple
   <code class="literal">
    SELECT
   </code>
   clauses, and each of
        these clauses supports up to 127 windows. The number of distinct
        windows is defined as the sum of the named windows and any
        implicit windows specified as part of any window function's
   <code class="literal">
    OVER
   </code>
   clause. You should also be aware that
        queries using very large numbers of windows may require
        increasing the default thread stack size
        (
   <a class="link" href="server-system-variables.html#sysvar_thread_stack">
    <code class="literal">
     thread_stack
    </code>
   </a>
   system variable).
  </p>
 </div>
 <br/>
</div>
