"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.
>
I ran the script below on 3.23.32 on NT4 to try and duplicate your bug but
it works fine. Are the commands below the same as you are using?
--script start--
use test;
CREATE TABLE notices (id int auto_increment PRIMARY KEY, title varchar(255),
priority int) TYPE=MyISAM;
insert into notices (id, title, priority) values (1,'a',1);
insert into notices (id, title, priority) values (2,'b',2);
insert into notices (id, title, priority) values (3,'c',3);
insert into notices (id, title, priority) values (4,'d',4);
insert into notices (id, title, priority) values (5,'e',5);
delete from notices where id=1;
update notices set priority=priority-1 where priority>1;
--script end--
Jeff
---------------------------------------------------------------------
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