We have the following structure for Organizations. Query returns the result What I’m trying to do is let’s say I need to get the Department (Information Technology Department) of org_id 4 (Database Unit), how should I build the query for that? Currently we built a function that returns the department id which basically loops until it reaches the DEP parent.
Tag: hierarchy
Hierarchy Queries in BigQuery
I have a data from ControlM (scheduler) this way I saw many solutions where they have started from first node and descended to last node. But that is likely to fan-out with this data. What I am looking for a fan-in solution, where I can start with any end node and come towards first node In this case the answer
Assigning a HANA hierarchy query to a table variable leads to inconsistent results
Context I want to use the HANA HIERARCHY_TEMPORAL function to work on a SAP KNVH hierarchy with time intervals ; When simply used in a SELECT query, this works fine ; When otherwise using the very same query but assigning it to a table variable, the result is inconsistent. My problem This anonymous block works just fine using an HANA
Make parent and child hierarchy with records for parents as well as children
I have a parent-child id_table hierarchy – e.g. |parent|child| |——|—–| | | 0| | 0| 1| | 0| 2| | 0| 3| | 1| 4| | 1| 5| | 2| 6| | 4| 7| | …
Query with hierarchical structure and variable number of hierarchy levels
I have table ‘Areas’ containing customer’s areas: ID, AREA_NAME, PARENT_ID Areas are organized in hierarchy up to four levels using PARENT_ID pointing to parent’s AREA_ID. PARENT_ID for top level …
CTE or not for counting tree id’s referenced in secondary table
I have a simple tree table in which I reference types, sub-types (no level limit), brands and models for a simple inventory application. data structure is as shown below: (nodeIsModel is a boolean …
How to flatten parent-child hierarchy from bottom up using CTE
for my first question on stack overflow I have the following problem, I’ve got an hierarchy table that looks as follows: The data looks as follows: the row with the wbe_node_type ‘leaf’ is the lowest level in the hierarchy, maximum depth is 8 levels deep. What I want is to flatten the hierarchy in one row from the bottom level
Returning all components multiple levels under a parent component
I have a hierarchical database out of which I would like to return all components in an asset with a specific common parent component. Components in table astComponents are linked to their parent …
Root level node is not coming in result
I am new to the Oracle Hierarchical Queries. I have one table and have the below data. Table Data Result Data My question is why parent id(100) is not included in the result? Below is the query. …
SQL to retrieve parent-child relationship in parent-child order, from a self referencing table
I use the following query to retrieve the parent-child relationship data, from a table which is self referencing to the parent. — go down the hierarchy and get the childs WITH ChildLocations(…