1
아래의 쿼리에 LEFT JOIN을 추가하면 count (*)가 이상한 값을 반환하고 쿼리에 반환 된 총 행을 'level ':LEFT JOIN을 더한 후에 파손 된 수 (*)
SELECT `n`.*, exp_channel_titles.*, 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`
LEFT JOIN `exp_channel_titles`
ON (`n`.`entry_id`=`exp_channel_titles`.`entry_id`),
`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`
나는 완전히 엉망이되었습니다 ... 감사합니다!
@Iain :'describe exp_node_tree_6' 및'describe exp_channel_titles'의 결과를 게시하고 수행 할 작업을 간략하게 설명해 주시겠습니까? –