I have the below table that contains the Application Feature List:
ApplicationFeature
Id Name MenuId
Values are:
1 PatientSearch 2
ApplicationMenu
Id DisplayText Url ParentMenuId
Values are
1 Patient patient NULL
2 PatientSearch search 1
I need to fetch the menu information along with the features. So far I have only been able to get the mapped menu but not the parent menu item as well.
SELECT
AF.Name, AF.Id As FeatureId, AM.Id AS MenuId, AM.DisplayText,AM.Url
FROM 
ApplicationFeature AF 
INNER JOIN ApplicationMeny AM ON AF.MenuId=AM.Id 
My results only show the PatientSearch menu details but don't include the Patient Menu.
How can I cause the query to retrieve parent menu detail too?
Edit:
I need to get build the menu with Parent. In case a parent menu has another parent I need to include that menu also.
-- Parent(Id=2)
  --- SubParent(Id=10 & ParentId=2)
    ----ActualMenuMappedwithFeature(Id=30 & ParentId=10)
In the above case I want result with menu ids 30, 10, 2
 
     
     
    
