Hello Friends,
I have a table like below
id parent_id
10 0
12 10
13 1
14 12
15 14
I have above two fields. I want to find count of all the parents of 15.
For example parents 15 are - 14,12,10. So the count is 3 here. I need to go backwards and find the parents till the last parent has 0.
Otherwise
I need to find 15 has 3 parents or not .
How to write a query. Please help me!
Thanks