hierarchy

Flattening Hierarchy series using SQL Server CTE

喜你入骨 提交于 2019-12-23 22:36:40
问题 Looking for SQL Server CTE example to create hierarchy in such a way that I can output all the series like flattening the each hierarchy. e.g in family tree if root start from grand Parent I need list of each family memeber's hierarchy list with member details + parent's row details like child1 row child1 +Parent row child1 + Grand parent Row child2 Row child2 + parent row child2 + grand parent's row and so on CREATE TABLE Family(id int NULL, Name varchar(20) null, Parent_id int NULL, level

Fast way to “flatten” hierarchy table?

允我心安 提交于 2019-12-23 17:57:47
问题 I've got a very huge table with hierarchy which can not be modified. Nodes in the table have an Id , ParentId , a Level and some data. The Level means that node with level N can be a child not only for level N-1 but also for level N-2 , N-3 etc. The good news are that the number of levels is limited - there are only 8 of them. Level 1 is on the top of the hierarchy and level 8 is the end of it. And now I need to flatten that table with respect to the place of the levels. The result should be

MySQL: join many tables on one Statement

筅森魡賤 提交于 2019-12-23 17:55:19
问题 i have the following DB-Structure / hierarchy: TABLE product_type : id,name, .... TABLE product : id,parent_id, name, ... parent_id : is the product_type id TABLE treeNode : id, parent_id, name, type its a tree hierarchy (roots have n sub Nodes) the number of levels of hierarchy is unknown . the col type has the values "CATEGORY" OR "GROUP" , that means, i have 2 trees: Categories: TreeNode 1 sub 1.1 sub.1.1.1 sub.1.1.2 .... sub 1.2 sub.1.2.1 sub.1.2.2 .... TreeNode 2 sub 2.1 sub.2.1.1 sub.2

Python - How to determine hierarchy level of parsed XML elements?

◇◆丶佛笑我妖孽 提交于 2019-12-23 11:46:35
问题 I am trying to parse elements with certain tag from XML file with Python and generate output excel document, which would contain elements and also preserve their hierarchy. My problem is that I cannot figure out how deeply nested each element (over which parser iterates) is. XML sample extract (3 elements, they can be nested arbitrarily within themselves): <A> <B> <C> </C> </B> </A> <B> <A> </A> </B> Following code, using ElementTree, worked well to iterate over elements. But I think

Python - How to determine hierarchy level of parsed XML elements?

旧时模样 提交于 2019-12-23 11:46:27
问题 I am trying to parse elements with certain tag from XML file with Python and generate output excel document, which would contain elements and also preserve their hierarchy. My problem is that I cannot figure out how deeply nested each element (over which parser iterates) is. XML sample extract (3 elements, they can be nested arbitrarily within themselves): <A> <B> <C> </C> </B> </A> <B> <A> </A> </B> Following code, using ElementTree, worked well to iterate over elements. But I think

D3 Tree Graph - Text Center, Controlling Height, and Link Arrow Odd Behavior

随声附和 提交于 2019-12-23 03:15:16
问题 I am working on a D3 Tree Graph with this fiddle: http://jsfiddle.net/q1a6o1o8/2/ I am having some issues with the following: I can't seem to properly center the text inside the rectangle nodes. I haven't had a problem when using circles. "text-anchor" "middle' isn't working. I'm trying to avoid using the "x" attribute to center so that the text is always centered inside the "rect" regardless of its length. Is there a way to make the rectangles responsive so that basically the width or height

SQL - ordering a common table expression

爷,独闯天下 提交于 2019-12-22 18:49:05
问题 Using this sample table: drop table Population CREATE TABLE [dbo].[Population]( [PersonId] [int] NOT NULL, [Name] [varchar](50) NOT NULL, [MotherId] [int] NULL, [FatherId] [int] NULL ) ON [PRIMARY] insert Population (PersonId, [Name], MotherId, FatherId) values (1, 'Baby', 2, 3) insert Population (PersonId, [Name], MotherId, FatherId) values (2, 'Mother', 4, 5) insert Population (PersonId, [Name], MotherId, FatherId) values (3, 'Father', 6, 7) insert Population (PersonId, [Name], MotherId,

Recursive CTE to find all ancestors OF ALL ITEMS

北城余情 提交于 2019-12-22 09:15:07
问题 I have a simple hierarchy and need to be able to generate a single table that matches EACH item in the table with ALL of its ancestors. (Caps to emphasize that this is not a duplicate question!) So here's a table: Select Item='A', Parent=null into Items union Select Item='B', Parent='A' union Select Item='C', Parent='A' union Select Item='D', Parent='B' union Select Item='E', Parent='B' union Select Item='F', Parent='C' union Select Item='G', Parent='C' union Select Item='H', Parent='D' Go ..

Oracle Hierarchical Query

蹲街弑〆低调 提交于 2019-12-22 07:58:25
问题 Using Oracle 10g. I have two tables: User Parent ------------- 1 (null) 2 1 3 1 4 3 Permission User_ID ------------------- A 1 B 3 The values in the permissions table get inherited down to the children. I would like to write a single query that could return me something like this: User Permission ------------------ 1 A 2 A 3 A 3 A 3 B 4 A 4 B Is it possible to formulate such a query using 10g connect .. by syntax to pull in rows from previous levels? 回答1: you can achieve the desired result

jQuery to get next match in the DOM after a particular element

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 06:33:03
问题 I hate to admit it but I'm stuck trying to figure out how to do this. e.g. pretending you have the following structure: <div> ... <div> <ul> <li> <a href="..."><img class="foo"/></a><!-- "previous" --> </li> <li> <a href="..."><img class="bar"/></a> </li> <li> <a href="..."><img class="foo"/></a><!-- I'm at this node --> </li> <li> <a href="..."><img class="baz"/></a> </li> <li> <a href="..."><img class="foo"/></a><!-- "next" 1 --> </li> </ul> </div> ... <div> <ul> <li> <a href="..."><img