I would second what m. dykman says. There is no reason I can think of that
you would even be doing the order by clause.

keith


On Sun, Jul 13, 2014 at 11:16 PM, yoku ts. <yoku0...@gmail.com> wrote:

> Would you try this?
>
> CREATE PROCEDURE `reset_sortid` (IN category INT(11))
> BEGIN
>         SET @a = 0;
>         UPDATE
>                 documents SET sort_id = (@a := @a + 1)
>         WHERE
>                 document_category = category
>         ORDER BY
>                 sort_id;
> END
> //
>
>
> 2014-07-14 11:42 GMT+09:00 Don Wieland <d...@pointmade.net>:
>
> > 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
> >
> >
>



-- 



(c) 850-449-1912
(f)  423-930-8646

Reply via email to