Some help with Mysql queries

hello I would really appreciate if you could help me I need to make a query in mysql or it can be combined with php:
I have a table with 2 fields, the first column has the Parent id and the second has the Child id and all the records are related until the master parent chain is cut:
the table looks like this no other table exists:
idParent | idSon |
2 | 3 | → 2 is the primary parent and child is 3
3 | 5 | ->then 3 becomes the father of 5
5 | 6 | ->then 5 becomes the parent of 6 and so on until the chain is broken
so i need to display all the records of master parent with id 2
of course there are more primary parents who have their respective children
Thank you very much in advance, I want to do it in a blank app
Bernard

1 Like

so what is the question exactly?

basically you get refined search fields in SC grid, you add parent and child fields and SC will generate search structure for you.
you can also use search module,
you can make a filter variable , add it to your sql query and assign value on click,
so many ways with SC.

If I understand correctly you are attempting to do a recursive query. This may help: A Definitive Guide To MySQL Recursive CTE

1 Like

Dear Maximi,
Thank you very much for your answer
Regards
Bernardo

Dear Alan,
Thank you very much for your answer
Regards
Bernardo