Answer the question
In order to leave comments, you need to log in
SQL query. How to select records with 2 older parents but no children?
There is a table test_table, which has 3 fields: *id(int), name(text), parent_id(int). An example of filling a table:
cfcd2
->d3d94
->6512b
->c74d9
->a5771
->4e732
->6ea9a
->d6459
c4ca4
->c20ad
->c51ce
->3c59d
->37693
->aab32
c81e7
eccbc
->67c6a
a87ff
select t1.* from `test_table` t1 left join `test_table` t2 on t2.id=t1.parent left join `test_table` t3 on t3.id=t2.parent where (t1.parent>0)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question