Before I start I know that this can be solved by first executing the query.
SET SQL_SAFE_UPDATES = 0;However, I am wanting to perform the update without having to first change the database's configuration every time.
I am attempting to update the table:
CREATE TABLE `nested_category` ( `category_id` INT AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(20) NOT NULL, `lft` INT NOT NULL, `rgt` INT NOT NULL );
Using the query:
UPDATE `nested_category` AS ns1 INNER JOIN `nested_category` AS ns2 ON (ns1.`lft` >= ns2.`rgt` OR ns1.`rgt` > ns2.`rgt`) SET ns1.`rgt` = ns1.`rgt` +2, ns1.`lft` = ns1.`lft` +2 WHERE ns1.`category_id` = @sumID;
Does anyone know why I cannot perform this, and/or how I can perform it without having up change database settings?