Hi guys,

I'm trying to follow the guide here:

http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

on setting up a Nested Set Model for hierarchical data.

I'm following the guide, on a sqlite database using PHP.

SELECT @myRight := rgt FROM nested_category
WHERE name = 'TELEVISIONS';
UPDATE nested_category SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE nested_category SET lft = lft + 2 WHERE lft > @myRight;
INSERT INTO nested_category(name, lft, rgt) VALUES('GAME CONSOLES', @myRight + 1, @myRight + 2);
UNLOCK TABLES;

Can someone please explain why this will not work?

I've never seen := before. And never used variables without SET.

Maybe this is too advanced for sqlite?

Thanks for your help

    The := operator assigns the value on the right to the user variable on the left, allowing you to set variables without using SET. It may well not be supported by SQLite, in which case you may need to use a SET statement instead. (I'm not conversant enough with SQLite to know if even that would work. 🙁 )

      Write a Reply...