Sitemap

Amicuk Programming Answers

HOW TO COUNT IMMEDIATE CHILDREN OF A NODE?

-0001-11-30   Views:1

Advertisement

Hi I need count the immediate children for all node of a tree with analitic functions. Somebody have any idea?. tyHi, Sg049 wrote: Frank, OP was asking for Immediate children.That's right. The query I posted shows how many immediate children each nod

Hi
I need count the immediate children for all node of a tree with analitic functions.
Somebody have any idea?.
ty

The replay answer
Advertisement
Hi,
Sg049 wrote:
Frank,
OP was asking for Immediate children.That's right. The query I posted shows how many immediate children each node has, even if that number is 0.
(Of course, it depends on what "immediate children" means. This is one example of why it's so important to post the exact results wanted from a given sample data set.)
Where is that query going wrong? If we add mgr to the SELECT (and GROUP BY) clause (just to make it easier to debug),
SELECT       m.empno
,       m.ename
,       m.mgr
,       COUNT (e.empno)     AS children
FROM              scott.emp  m
LEFT OUTER JOIN      scott.emp  e  ON  e.mgr  = m.empno
GROUP BY  m.empno
,            m.ename
,       m.mgr
;the results are:
`    EMPNO ENAME             MGR   CHILDREN
      7839 KING                           3
      7499 ALLEN            7698          0
      7934 MILLER           7782          0
      7369 SMITH            7902          0
      7876 ADAMS            7788          0
      7698 BLAKE            7839          5
      7782 CLARK            7839          1
      7566 JONES            7839          2
      7654 MARTIN           7698          0
      7900 JAMES            7698          0
      7902 FORD             7566          1
      7521 WARD             7698          0
      7788 SCOTT            7566          1
      7844 TURNER           7698          0KING is the ancestor (immediately or not) of all the 13 other rows, but the children value for KING is just 3, because only BLAKE, CLARK and JONES are immeditate children. Where is the mistake?
If the query I posted just happens to get the right results from scott.emp, but will not get the right results with other data, then post CREATE TABLE and INSERT statements for an example, and point out where it is wrong.

Go to See the other 7 answers

HOW TO COUNT IMMEDIATE CHILDREN OF A NODE?

Category:DefaultRelease time:-0001-11-30Views:130

Hi I need count the immediate children for all node of a tree with analitic functions. Somebody have any idea?. tyHi, Sg049 wrote: Frank, OP was asking for Immediate children.That's right. The query I posted shows how many immediate children each nod[More]

Scene Graph traversal. Getting all the children of a node recursively

Category:DefaultRelease time:2015-10-11Views:130

Hi, Requirement: To resize all the controls of a scene (including controls that contain text like label, button) as per the scene size Approach: To implement the above requirement (see code snippet below), I added Listeners for width and height prope[More]

Unable to traverse children of child Nodes for w3c.dom class

Category:DefaultRelease time:-0001-11-30Views:130

Hi Folks, I'm trying to Traverse children of child nodes but unfortunately its not working. Here is the snippet of my code.. String xpath = "//*[starts-with(name(), 'PosRpt')]";           String xpath1 = "/FIXML/Batch/PosRpt/*";       [More]

How to count hits on external navigation nodes ?

Category:DefaultRelease time:-0001-11-30Views:130

Hi there, our navigation is a mix of PCD generated navigation nodes and those generated by an external navigation connector. Now we can count hits on the PCD nodes (which are basically related to iviews) using "Portal activity report" . BUT how[More]

How to show only all children of selected node in JTree??

Category:DefaultRelease time:2015-10-11Views:130

Dear friends: I have Two Panels, PA and PB, PA has a Jtree as code below, and PB listens to PA, I hope to do following, If I select a node called A in PA, then Node A's all children such as A1, A2, A3 will be displayed in PB, but not display A1, A2,[More]

How to restrict max children for a node containing different node types

Category:DefaultRelease time:2015-10-11Views:130

Hi, I have the following XML: <categories>     <category id="hsp">         <cardUsage id="hsp.approvals">             <tabUsage id="hsp.approvals.puListing"/>             <tabUsage id="hsp.appr[More]

Function Module to get children of a node of a hierarchy.

Category:DefaultRelease time:-0001-11-30Views:130

Does anybody out there know of a function module which can return the list of children beneath a BW hierarchy node. For example: to return the individual Plants from a hierachy node for 0PLANT?Hello GB, I am having same issue. Please help by sending[More]

Counting Nodes

Category:DefaultRelease time:-0001-11-30Views:130

Noob question. This statement: var nTableLength = TableKM.nodes.length; is intended to count the child objects (rows) of a table which in my case should be a value of 3. But the value in the debugger indicates that it is counting the children of the[More]

How to count number of xml nodes , with JSTL XML api?

Category:DefaultRelease time:2015-10-11Views:130

I am trying to count the number of nodes in the parsed xml by doing this: <x:out select="count($doc/Items/Item)"/> There are about 50 item nodes in the source xml, but I get the output as 0 Is this syntax correct? I searched every where bu[More]

Count child of every node in hier table reading source just once

Category:DefaultRelease time:-0001-11-30Views:130

Hi guys, I'm trying to write a SQL statement to count how many child every node in a hierarchical table has. I want to perform this operation reading source table only one time. Following an example of source table: CREATE TABLE TEST_HIER ID NUMBER,[More]

How to count nodes?

Category:DefaultRelease time:-0001-11-30Views:130

I'm new to DOM and am trying to understand the node hierarchy structure. I have the following sample XML file. To understand what constitutes a "Node", I count and print the child nodes that are within the "slideshow" node. The result[More]

Hot
When i try to send email from my ipad i get the message The recipient "£)()&&£)" was rejected by the server. This has only just started to happen and I don't know why. Please can someone help. I have tried lots of things now and cannot s [More]
How can I remove my credit card from my AppStore?You do not have "None" because your card have expired. You have to contact iTune Support https://ssl.apple.com/emea/support/itunes/contact.htmlRead other 7 answers [More]
I am trying to create a Font as follows: InputStream is = new FileInputStream("myname.ttc"); Font font = Font.createFont(Font.TRUETYPE_FONT,is); This works fine but I need to get a specific font from the collection. How does one go about creatin [More]
idk why but today i pluged it in to charge and it was fine then when i got home and pluged it in it says that my ipod cannot be synced so i un pluged it and pluged it back it and it keeps saying the same thing, and i cant add any new music to my ipod [More]
I want to change the speakers thqat came with the IMAC G4 Flat panel to a pair of Klipsch that have an RCA plug...The plug in for the original speakers seems to be some kind of special miniplug...Can someone help me find an adapter for Klipsch RCA pl [More]
Hi, I've had my Lacie External hard drive for about 4 months and i have a recurring problem, it wont always show up in finder or on the desktop. It shows up in disk utilities just fine, but stupidly the first time this happened i didn't know that you [More]
Hi all, I am getting this error during server installation..(NW2004s installlation with PI)... Execution of the command "C:\j2sdk1.4.2_09\bin\java.exe -classpath migmon.jar -showversion com.sap.inst.migmon.imp.ImportMonitor -dbType ORA -importDirs ct [More]
Hi, I'm new to siebel enviornment, I installed siebel and try to configure bip integration part Step 1: I stoped siebel services, and then I copied the siebel srf file to siebel tools driectory and then imported pix files and compiled it and then I t [More]
To add a comment, please log in or register on the top of this page and choose Reply. Please write your comment in English. You can also go back to the SAP help page.Hi, It is a CRM Addon: Desktop Connection for SAP CRM – SAP Help Portal Page Best Re [More]
I have been reading some of the other slow running mac solutions. can someone look at my EtreCheck. thanks EtreCheck version: 2.0.11 (98) Report generated December 1, 2014 at 9:12:44 PM PST Hardware Information: ℹ️   MacBook Pro (15-inch, Early 2011) [More]