Good morning, I´m trying to move up and down nodes in traversal tree, but problem is, that if I have query for moving node up, it throws me an error in sql syntax, please, do you have any idea, where the problem is?
UPDATE categories
SET lft = IF( lft >= 17 AND rgt <= 18, lft + 1, IF(lft >= 15 AND rgt <= 16, lft - 1)),
rgt = IF( lft >= 17 AND rgt <= 18, rgt + 1, IF(lft >= 15 AND rgt <= 16, rgt - 1))
WHERE (rgt <= 18 AND lft >= 15)
Thank you for your answers and solutions!
EDIT: Thank you for your help, it works except one problem - second condition. It doesn´t do anything with right values: parent rgt is still same and rgt of moved element is setted to 0. Where could be problems? So problem solved. My faul. I was comparing edited values to so it was mistaken.