Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT n.*, (select count(n1.id) from category as n1 left join items as p1 on p1.category_id = n1.id WHERE n1.id >= n.lft AND n1.id <= n.rgt AND n1.root_id = n.id group by p1category.id) as itemGrpCnt FROM category as n LEFT JOIN items as p on p.category_id = n.id where n.id = 9
Add Comment
Please, Sign In to add comment