"Guridi, Tomas" wrote:
>
> Hi , i´m having a strange problem with the update in mysql
> i have a table named "notices" with the following fields:
>
> id :prymary, int, auto_increment.
> title :varchar (255).
> priority :int.
>
> inside this table i have 5 registers like this :
>
> id title priority
> 1 a 1
> 2 b 2
> 3 c 3
> 4 d 4
> 5 e 5
>
> now... to explain exactly what im doing y will write the exact querys im
> giving o the database.
>
> DELETE FROM notices where id=1
> UPDATE notices SET priority=priority-1 WHERE priority > 1
>
> The result for this should be the following:
>
> id title priority
> 2 b 1
> 3 c 2
> 4 d 3
> 5 e 4
>
> The result im getting is :
>
> id title priority
> 2 b 1
> 3 c 1
> 4 d 2
> 5 e 3
>
> i have tryed everything,
> i foud that there was a problem with the update using the "WHERE priority>1"
> and they recommended using "WHERE priority+0 >1"
> i also try that without having good results. the part that is even more
> strange is that if i run this querys from the console of the phpMyadmin the
> result comes out rigth. i really don´t know what to do.
>
> i am running on a NT 4.0 platform but i also try it on a REDHAT 6.2 platform
> having the same wrong result.
> if anybody could help please let me know.
>
You do not say what version you are running.
Older versions did not allow updating the primary key field in that
manner.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php