Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9115543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:27:28+00:00 2026-06-17T04:27:28+00:00

I have the following nested set. The cat.table: cat.ID Name Lft Rgt 1 A

  • 0

I have the following nested set.

The cat.table:

cat.ID Name Lft Rgt
  1     A    1   8
  2     B    2   5
  3     C    3   4
  4     D    6   7
  5     E    9   14
  6     F   10   11
  7     G   12   13

OUTPUT: In brackets the count of the items. (In ‘A’ will count that items, which are in its node, too – B, C and D)

 A (7)
 -B (3)
 --C (2)
 -D (1)
 E (3)
 -F (1)
 -G (2)

The Items table:

ID Cat.ID  Name
1    1     item1
2    2     item2
3    2     item3
4    2     item4
5    3     item5
6    3     item6
7    4     item7
8    6     item8
9    7     item9
10   7     item10

If I select the Cat A than I would like to select that items which are in the B, C and D, too. If I select the B, than show the item from B and C. If I select the F than only show from F…
In the Items table I don’t have left and right values only tha Cat.ID.

How do I know that if I select the “A” category, which items are in “B”, “C” and “D” too?

EDIT:
E.g:
If I select B than show the items from B and C (the B is parent of C and C is node of B) – output:

item2
item3
item4
item5
item6
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:27:29+00:00Added an answer on June 17, 2026 at 4:27 am

    The answer is in the Retrieving a full tree paragraph of the linked article.

    SELECT Id,Name FROM Items WHERE cat_id IN (
    SELECT cat_id
    FROM category AS node,
        category AS parent
    WHERE node.lft BETWEEN parent.lft AND parent.rgt
        AND parent.name = 'A')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that produces the following output in a nested set structure:
How can I count nested list elements in Prolog? I have the following predicates
I have an application that uses a nested set model class to organise my
I have a set of nested yaml lists with something like the following: title:
I am making a nested comment system, and I have the following table: create
I have the following set up Custom Control 1 - MyListControl - Nested Collection
I have following nested objects. I am using @Valid for validation in my controller.
I have the following nested dictionaries: Dictionary<int, Dictionary<string, object>> x; Dictionary<int, SortedDictionary<long, Dictionary<string, object>>>
I have the following nested for loops. I want to parallelize the first loop
I have the following data and nested for loop: x <- c(12, 27, 21,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.