there is a table: Groups
It has three columns: ID, NAME, PARENT
This would flow in the following way.
- Suppose there is a Group ELECTRONICS
- Under ELECTRONICS, there is MOBILE
- Under MOBILES there is SAMSUNG
- Under SAMSUNG there is GALAXY EDGE
- Under GALAXY EDGE there is 16GB and 8GB
the data in database would follow like:
ID NAME PARENT
1 ELECTRONICS null
2 MOBILE ELECTRONICS
3 SAMSUNG MOBILE
4 16GB SAMSUNG
5 8GB SAMSUNG
There may be N levels of hierarchy. I want to retrieve all the records of the last level. In this case, return 16GB and 8GB.