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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:34:58+00:00 2026-05-25T00:34:58+00:00

I got a problem with my db design, I am developing a forum in

  • 0

I got a problem with my db design, I am developing a forum in which you can add topcis and then subtopics inside that forum and so on but in that subforum It must show the answers of that topic, and the subtopic, so you have a parent topic and children, my problem comes with the id, I mean for example when you create a topic id=1, then you assign parent_id=1, but how do you know the children of that topic, for example topic id=2, parent_id=1, you can assign to the children id=2, but are there a better way? how would be your approach to solve this problem? also mysql I dont k

I got two tables

“Topic”

id
name
id_creator
date
message
parent_id

“answer”

id
name
message
id_creator
date

  • 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-25T00:34:59+00:00Added an answer on May 25, 2026 at 12:34 am

    I had to do this in MySQL recently, MySQL unfortunately does not offer anything useful for processing hierarchical data.

    I used an extra varchar column called path where I would store the ‘path’ leading to current item. E.g. a row with an id=127 which is a child of id=120 which is a child of id=15 would have its path=’/15/120/127′.

    You need to take care of this on your own when inserting data.

    Extracting all rows that are direct or non-direct children of a row with id=15 would then look like:

    SELECT * FROM table WHERE
      path LIKE '%/15/%'
    

    I can also see that this is a rather much discussed topic here on Stackoverflow. Look on the right in Related column next to this question.

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

Sidebar

Related Questions

I'm facing a problem which is probably extremely common in game-design. Let's assume that
I got this problem, The deserializer has no knowlege of any type that maps
I got the following problem In Eclipse, in the Report Design Perspective , when
I am developing an application that uses Entity Framework and WPF with MVVM design
I have a problem which is caused by our encapsulated design. Up till now
I'm facing a design challenge that I just can't seem to solve in a
got another problem with my new design: ! Ugly border It's on a slider
I've got a problem in Crystal Reports that's been bugging me for years, and
I have got a css problem. http://www.luukratief-design.nl/dump/parallax/index.html I cant get this page to align
I got the following problem. I have a design similar to this jsfiddle: http://jsfiddle.net/k3EUx/

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.