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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:15:50+00:00 2026-06-13T07:15:50+00:00

I have a many to many relation between two tables in my database (MySql)

  • 0

I have a many to many relation between two tables in my database (MySql) :

  • Category (id, name, id_parent)
  • Sound (id, name)

A category can have 1 parent category, so a category can have many children. If a category has at least one child, it has no sounds in it. I do not allow sounds and children categories together.

So for a parent category, i want to get all children that may have children that may have children (…) and i want to count sounds in all children recursively.

Exemple :

Cat -> (CCat1 -> CCCat11(2 sounds), CCat2 (5 sounds), CCat3 -> CCat31 -> CCCat311 -> (CCCCat3111 (10 sounds), CCCCat3111 (1 sound))

There is no deep limit, that’s why i need a “recursively” way to count sounds.

  • Cat has 3 children.
  • CCat1 has 1 child.
  • CCat2 has no child.
  • CCat3 has 1 child that has 1 child that has 2 children.

Cat.nbSounds = 18

  • 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-13T07:15:51+00:00Added an answer on June 13, 2026 at 7:15 am

    After more researches it seems that we can’t do what i want.

    So i created a recursive method that retrieve children and calculate the number of sounds in each category (i count sounds in the category or i count categories children number of sounds).

    If you find a magical way to do it anyway with linq to entities, i take it !

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

Sidebar

Related Questions

i have two tables: 1) Users 2) Scenarios Relation between them can be described
In my DB I have two relation between two tables : A many to
I have two classes with many-to-many relation so I created a join table in-between
I have a number of many to many relationships between two tables with conditionals
I have a many-to-many relation in 3 tables: ProgramUserGroup and Feature are the two
I have two tables A and Band the relation between A to B is
On the database, I have these two tables: - Destination: - idDestination - name
I have a Many-to-Many relationship between two tables. I'd like to sort the first
I have a question about One-To-Many relationship between two tables when there is the
I have a one-to-many relation between Parent and Child table. In the parent object

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.