I have following SQL table
Area
id name parent_id
1 Pune null
2 Mumbai null
3 area1 1
4 area2 3
Here I have logical foreign key parent_id
so that area2
has the parent area1
and area1
has parent Pune
. Here I want to select topmost parent of any subarea.
For ex. when i search area2
then it will give result Pune
.