All Questions
6 questions
0
votes
1
answer
155
views
SQL Pattern to get "root/ start" of uneven hierarchy dataset
I feel this is a common problem and I've seen it in some SQL challenges even but for the life of me, cannot think clearly about a solution.
Say you have an uneven hierarchy. Elements that belong to ...
0
votes
1
answer
174
views
MSSQL Merge 3 hierarchy tables
I want to merge 3 hierarchy tables into one table.
The 3 tables:
CREATE TABLE dbo.tbl1 (
key1 varchar(50) NULL,
key2 varchar(50) NULL
) ON PRIMARY
CREATE TABLE dbo.tbl2 (
key2 varchar(50) ...
2
votes
1
answer
430
views
Correct way to join row in parent table to row in one of several children tables
I have a parent table product, and several children tables like phone, tablet, smartwatch etc. The parent and children have 1-1 relationship. This means that for every row in parent table, there will ...
5
votes
2
answers
50k
views
Parent Child Relation in same Table
I have a table storing parent/child records as such:
+-------+------------+---------+---------+------------+-----------+
|custid | custname | deptid | company |parentcustid| enrolled |
+=======+==...
1
vote
0
answers
2k
views
Joining recursive table in PostgreSQL
Situation
I have two simple tables, one called "node_relations" and one called "node_information". The table "node_relations" represents a simple parent-child hierarchy, having only two columns "id" ...
0
votes
1
answer
312
views
queries for hierarchical data
This table is a questions and answers CMS and i want to know how data is fetched from these tables.
+------+----------+-------+
| id | parentid | type |
+------+----------+-------+
| 1 | 0 ...