I have a table with sample values as below In this table, all the values in Col1 will have its supporting values in Col2. The values A1 and A2 are like master values and they will never appear in Col2. I need to make an output displaying this master values in a new column like below What would be the
Tag: hierarchical-data
temporal joins in hierarchical query
I want to join various nodes of a tree, making sure the the returned root-to-leaf path is temporally valid. The tricky part is that the data source is dated with validity from-to dates. ID NVALUE VFROM VTO 1 A 2021-01-01 2021-01-31 1 B 2021-02-01 2021-02-28 2 C 2021-01-01 2021-02-28 3 D 2021-01-01 2021-01-31 3 E 2021-02-01 2021-02-28 the links are
How to get the third level of a tree in SQL
I aim to list the forth generation of a family using SQL Server. Example family tree in the picture (id based) FAMILY TREE The tables I have are: Family +——+—————–+ | f_id | f_name …
Calculate a column value backwards over a series of previous rows/RECURSIVE/CONNECTED BY
need your help. I guess/hope there is a function for that. I found “CONNECT DBY” and “WITH RECURSIVE AS …” but it doesn’t seem to solve my problem. GIVEN TABLES: Table A +——+-…
how i can get all products from parentid in SQL Server?
I have a category table to name TBL_category And includes the following fields: nid i identity field and i have a production Table TBL_Productions and foreign key is to nid And includes the following fields: productid is identity My question is: How can I display all products, when user selected mobile category ? I have nothing to do with the
Find ALL the prerequisites for a given course
I have the following tables: COURSE_PREREQUISITES My question is: How can I obtain all the course ids a student needs to take before he can take course id 6? Intended Answer: I should obtain the course id of 1, 2, 3, 4, 5. Attempts Made: I have tried selecting the prerequisite_course_id of the intended final course id 6, and nesting
select linked rows in the same table
I’m creating a branching dialog game, and used a dialog tool that outputs JSON with a link and a link_path to connect dialogs together. I’ve parsed and inserted this structure in PostgreSQL. I want to …
MySQL – Recursively list all parents and ancestors of all items in table
I have a table with a parent/child hierarchy that supports multiple (theoretically infinite) levels of nesting: I am trying to build a query that produces a concatenated list of every item’s parent items up until the highest parent in the tree: Based on a number of other answers here I have constructed the following MySQL query: See Fiddle here: http://sqlfiddle.com/#!9/48d276f/902/0
Sql Database design hierarchy
I have been tasked to create an app to track our contracts. I am planing to use Django and PostgreSQL. Our existing data is in Excel with 52 rows. I have found an hierarchy pattern in the file which contains as below Holding Office Registered Office Operating Office For example – Holding office (company) can contain one more Registered Office
Oracle SQL/PLSQL: Hierarchical recursive query
I have asked very similar questions before but still haven’t achieved the correct result… third times the charm but I now have a stable parent-child relationship to work with. Every row in the multi-level data set has a cost. For a specific row I need to find the lowest level and roll-up the cost. Then my users will compare the