Sunday, 15 September 2013

#1054 - Unknown column 'node.id' in 'on clause'

#1054 - Unknown column 'node.id' in 'on clause'

Trying to work with a nested set model. Retrieving a Single Path, starting
at 'Pakken', the parent of it is 'Heren', but since this is hierarchical
data, 'Heren' could have an unlimited amount of parents to himself.
I'm stuck on the join, giving me this error
#1054 - Unknown column 'node.id' in 'on clause'
From this query where I try to join the product where his
products.category_id must be equal to the selected id of the objects
(node).
SELECT *
FROM `categories` AS `node`,
`categories` AS `parent`
INNER JOIN `products` ON `node`.`id` = `products`.`category_id`
WHERE `node`.`lft` BETWEEN `parent`.`lft` AND `parent`.`rght`
AND `parent`.`id` = '1'
ORDER BY `node`.`lft`;
Code works fine without the INNER JOIN to it.
Thanks :)

No comments:

Post a Comment