why do you need the 'order by' in your update at all?  The statement, if
innodb, will certainly be atomic; the order in which they are updated means
nothing.
 On Jul 13, 2014 11:46 PM, "kitlenv" <kitl...@gmail.com> wrote:

> maybe try 'order by sort_id desc'?
>
>
> On Mon, Jul 14, 2014 at 12:42 PM, Don Wieland <d...@pointmade.net> wrote:
>
> > I am trying to create this stored procedure, but can't understand why my
> > editor is chocking on it. Little help please:
> >
> > DELIMITER //
> > CREATE PROCEDURE `reset_sortid` (IN category INT(11))
> > BEGIN
> >         DECLARE a INT;
> >         SET a = 0;
> >         UPDATE
> >                 documents SET sort_id = (a := a + 1)
> >         WHERE
> >                 document_category = category
> >         ORDER BY
> >                 sort_id;
> > END
> > //
> >
> >
> > Don Wieland
> > d...@pointmade.net
> > http://www.pointmade.net
> > https://www.facebook.com/pointmade.band
> >
> >
> >
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:    http://lists.mysql.com/mysql
> >
> >
>

Reply via email to