Location Levels were created to make it easier to query the Locations based on it's position in the tree. The Levels (up to 8) are stored in the fields LVL1_ID, LVL2_ID,..., LVL8_ID. The field ParentID is still used to setup and display the tree but the LVLx_ID fields are calculated.
Example: I want to know any variable within the location Routine:
Routine is Location ID (LOCID) 55. The following query only returns DS002, DS004, and DS005, not East, South, North or Inf.
Select LocID,Location, ParentID
FROM LOCATION
WHERE PARENTID = 55
To get all the locations and their sub locations of Routine I can use the LVLx_ID fields. In this case I want where Level 2 is Routine. Routine's LOCID is 55 so the query becomes:
Select LocID,Location,ParentID,LVL1_ID,LVL2_ID,LVL3_ID,LVL4_ID
FROM LOCATION
WHERE LVL2_ID = 55
To get all variables in those locations:
Select VarNum,Name,Location
FROM VARDESC,LOCATION
WHERE VARDESC.LOCID = LOCATION.LOCID
AND LVL2_ID=55