How to use order by in update syntax on MySQL
<p>I want to use <code>order by</code> in this query: </p>

<pre><code>update mytable cross join
       (select @i := 0) params
    set mydate = mydate + interval 10 * (@i := @i + 1) hour;
</code></pre>

<p>My reference is from <a href="https://stackoverflow.com/questions/38799803/how-to-increment-the-interval-date-on-mysql">this question</a>, as in that question let say I want to order the PID descending,</p>

<pre><code>update mytable cross join
           (select @i := 0) params
        set mydate = mydate + interval 10 * (@i := @i + 1) hour order by PID desc;
</code></pre>

<p>But with that query I got <code>ERROR 1221 (HY000): Incorrect usage of UPDATE and ORDER BY</code></p>

<p>The original query is working fine but I can't use <code>order by</code> in it.</p>