Skip to content
Advertisement

select Parent Child Rows in same Table

I have table structure like below

I want to display only rows that have a relation parent child

like:

  • every child should have a parent
  • every parent should have at least one child

This is my code but it does not work properly:

Advertisement

Answer

The first condition checks if the row points to a parent, and the second condition checks if the row has any children.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement