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 6391771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:43:51+00:00 2026-05-25T03:43:51+00:00

I have this problem. I have a table (below) of groups. It’s a recursive

  • 0

I have this problem. I have a table (below) of groups. It’s a recursive sort of table because each new group can have a parent group in the same table. So effectively we have a group > subgroup > subgroup > subgroup kinda model.

**id | label | parent_id**
1 | Ceiling| 0 
2 | Window | 0
3 | Wall | 0
4 | Small | 2
5 | Large | 2
6 | Large| 1
7 | Paint | 4

So this would give something that looks like this:

Window > Small window > Paint

I’ve created the forms and table for creating the groups but it’s the database query and loops that I’m having trouble with actually getting data into the above format. Bit too much for my brain to handle 🙁

I’m doing it in this format because I want there to be complete control over the groups and the depth of the subgroups.

I don’t really have code to give an example because it’s more the problem solving I’m after.

** UPDATE **

A bit more specific: I want to list each parent group (so a group that has a 0 set in parent_id) and it’s immediate subgroup, then that groups immediate subgroup (if it has any) etc, etc.

  • 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-05-25T03:43:52+00:00Added an answer on May 25, 2026 at 3:43 am

    If you want to do it like this, you will allways have to fetch whole table to PHP and then perform the search with php.

    However, there is one similar method how you can managet such structure, it is very vell described here:
    http://www.sitepoint.com/hierarchical-data-database-2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem where after a field (say Field3 in table MyTable) is
I have a problem. Imagine this data model: [Person] table has: PersonId, Name1 [Tag]
I have a problem with DBMS_DATA_MINING.CREATE_MODEL on version 11.2. On 10g this code below
I have this problem. Given a users table that consists of users' username in
Update I have posted my solution to this problem as an answer below. It
I have three tables being used for this problem: songs, blacklist, and whitelist. The
I have this mysql tables I want to display with jqgrid. The problem appears
So i'm having this problem. I have two tables (Oracle), one is called Destination
I have this problem I'm hoping someone knows the answer to. I have an
I have this problem where I open Visual Studio and the internal windows are

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.