Hey everyone,
Following up with the thread on SQL Trees and Nested Sets I thought I could use the code provided by MySQL site here and convert it to C#.
I'm hoping I could use LINQ to query the Tree Data Structure. I tried to do it by myself, but miserably failed lol. Hence I thought I'd ask for a quick conversion of one of the functions so I could use it a base to convert the others myself.
Code to convert:
I tried this and this but for some reason it did not work out for me...
Following up with the thread on SQL Trees and Nested Sets I thought I could use the code provided by MySQL site here and convert it to C#.
I'm hoping I could use LINQ to query the Tree Data Structure. I tried to do it by myself, but miserably failed lol. Hence I thought I'd ask for a quick conversion of one of the functions so I could use it a base to convert the others myself.
Code to convert:
SELECT node.name
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND parent.name = 'ELECTRONICS'
ORDER BY node.lft;
I'd like to be able to do that in LINQ, but I still can't figure out a way to do a self join... I tried this and this but for some reason it did not work out for me...