introduce a join to this query, possible?
Posted
by Iain Urquhart
on Stack Overflow
See other posts from Stack Overflow
or by Iain Urquhart
Published on 2010-04-04T13:12:03Z
Indexed on
2010/04/04
13:13 UTC
Read the original article
Hit count: 314
I'm trying to introduce a join to this query:
SELECT `n`.*, round((`n`.`rgt` - `n`.`lft` - 1) / 2, 0) AS childs,
count(*) - 1 + (`n`.`lft` > 1) + 1 AS level,
((min(`p`.`rgt`) - `n`.`rgt` - (`n`.`lft` > 1)) / 2) > 0 AS lower,
(((`n`.`lft` - max(`p`.`lft`) > 1))) AS upper
FROM `exp_node_tree_6` `n`, `exp_node_tree_6` `p`, `exp_node_tree_6`
WHERE `n`.`lft`
BETWEEN `p`.`lft`
AND `p`.`rgt`
AND ( `p`.`node_id` != `n`.`node_id` OR `n`.`lft` = 1 )
GROUP BY `n`.`node_id`
ORDER BY `n`.`lft`
by adding
LEFT JOIN `exp_channel_titles`
ON (`n`.`entry_id`=`exp_channel_titles`.`entry_id`)
after the FROM statement...
But when I introduce it, it fails with "Unknown column 'n.entry_id' in 'on clause'"
Is it even possible to add a join to this query?
Can anybody help, thanks!
© Stack Overflow or respective owner