First connect by: display of all of the hierarchy even if parameter child

31%

Hello

In our case the manager_id I = employee_id for high level manager. So when I run the sql code, it eliminates the high-level manager and shows the output for the next level of leave.

For the regular start with you connect option on the employee table, the query used is
select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
       level,
       First_name as title,
       NULL  as icon,
       EMPloyee_id as value,
       First_name as tooltip,
       NULL  as link
from EMPLOYEES
start with Manager_id is null
connect by prior EMPLOYEE_ID = Manager_id
order siblings by First_name
now, this will show the hierarchy and level from managers. Now, if we provide the 'start with Manager_id = 171' then as 171 isn't a Manager no row is returned. So, for this we can use something like
start with manager_id =171 or employee_id = 171
However, the output would be only the employee from 171 record is the last child.

The requirement we had was that, regardless of the value entry, be it ultimate parent or child ultimate output should always display the top to the bottom of the hierarchy. from this ultimate Manager of people.

Thus, for example, if there are two employees, 170 and 171 and 170 is the Manager of 171

If in this application, I use Start with Manager = 170. He will show me the Manager and the child records.

However, if I use start with manager = 171 or employee_id = 171, then it will show me only only the registration of the child. I want that he show me the Manager and the employee records. That is, all levels

I hope that makes sense!

Thank you
Ryan

Published by: ryansun on December 12, 2012 01:13

Published by: ryansun on December 13, 2012 01:59

Hello

Maybe you should post your results with different cases.

See if it fits your needs:

WITH entire_tree AS
(
    SELECT *
      FROM employees
     START WITH manager_id = 171
   CONNECT BY PRIOR employee_id = manager_id
   UNION
    SELECT *
      FROM employees
     START WITH employee_id = 171
   CONNECT BY employee_id = PRIOR manager_id
)
 SELECT CASE WHEN CONNECT_BY_ISLEAF = 1 THEN 0 WHEN LEVEL = 1 THEN 1 ELSE -1 END AS status
      , LEVEL
      , first_name AS title
      , NULL AS icon
      , employee_id AS VALUE
      , first_name AS tooltip
      , NULL AS link
   FROM entire_tree
  START WITH manager_id IS NULL
CONNECT BY PRIOR employee_id = manager_id
  ORDER SIBLINGS BY first_name;

Kind regards.
Al

Tags: Database

Similar Questions

  • Data warehouses do not appear on all of the hosts even though storage devices appear on all hosts

    I have a frustrating problem that I can't solve, my data stores do not appear on all of the hosts even though storage devices appear on all hosts.  Tips on troubleshooting this would be greatly appreciated, it is connected to a Synology NAS iSCSI environment and I use it for my VCAP studies right now, or was

    Tried a lot of things so far...

    -Recreate the target and starting from scratch

    -recreate the cluster from scratch

    -Restart the storage

    -Restart the hosts (I think that I did in all cases)


    And probably a few other things, would appreciate any other advice/lessons

    Post edited by: a.p. - title shortened to allow for answers

    Please take a look at KB VMware: vSphere management LUNS identified as LUN snapshot to see if that helps.

    André

  • Single request for the display of all, but the values of 1 column for all tables

    Hello

    All tables have the column SYS_CREATION_DATE.
    But I don't want to not display the value of this column

    Can anyone suggest a way in which I could achieve this?

    Oracle version: 11 GR 1 material
    OS: SunOS


    See you soon,.
    Malika

    Published by: user9131570 on July 6, 2010 19:57

    user9131570 wrote:
    @Tubby

    I * table-wise display the values of all but 1 columns (SYS_CREATION_DATE) in my database.*

    I need it to compare to another data base for all these values.

    I would like to make a wild guess at what you are getting.

    In view of these two tables

    create table emp
       (empid number,
        empname varchar2(15),
        empaddr   varchar2(15),
        sys_creation_date date);
    --
    create table dept
       (deptid number,
        deptmgr varchar2(10),
        sys_creation_date date);
    

    you want to combine somehow

    select empid,
             empname,
             empaddr
    from emp;
    

    with

    select deptid,
             deptmgr
    from dept;
    

    in a single sql statement?

  • My Blu - Ray player does not connect to internet at all after the firmware update

    before the update, I use to be able to connect to the internet, but now, it says there was a problem one can not connect. Help, please!

    RESET the unit to FACTORY settings?

    Perhaps this is an option, which will get you to where you were before the update.

  • First connect you by: what happens if the Parent is the child?

    Version: 11g

    Hello

    I had a question about starting with Connect by.

    Here is an example of using the ORacle of the Emploees table
    select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
           level,
           First_name as title,
           NULL  as icon,
           EMPloyee_id as value,
           First_name as tooltip,
           NULL  as link
    from EMPLOYEES
    start with Manager_id ='171'
    connect by prior EMPLOYEE_ID = Manager_id
    order siblings by First_name
    Now, this works very well and shows the levels. In aid to start with is in fact
    start with Manager_id is null
    Now, if we use a low level employee in using something like
    start with Manager_id = '171'
    no row is returned. This is because there is no record of the child for this employee (he is not a Manager).

    However, is it possible to at least show that the output of a disc? Any suggestions?

    Thank you
    Ryan

    Published by: ryansun on December 10, 2012 22:51

    A way

    start with
      ( manager_id ='171'
        or
         (
           employee_id='171'
           and '171' not in (
                             select distinct manager_id
                             from employees
                             where manager_id is not null
                             )
         )
      )
    

    Published by: JAC on December 11, 2012 12:35

  • Best way to display a report of the hierarchy tree to APEX 4.2

    I have a hierarchical query spans four levels over two tables.  The application works very well and also includes columns hierarchical sum (i.e. the parent displays the sum of all children) using functions.

    I wonder what is the best way to view these data for users?

    At the moment I think I would have a collection now my connection with the edition special 'show' column.  Then I would include HTML to define values correct show/hide and refresh the report when you click on a node.  In my view, this would probably work, but may not be the best way.

    I disassembled my request for necessary columns (no column of the sum) and the tree APEX regions work well for this.  Y at - it a plugin alternative jquery or anything that people with what will give me the directory structure 4.2 native while allowing me to display additional columns with links?

    If I need to provide more info let me know!

    LSDev wrote:

    I'm going to use today to test these ideas, and if they don't work I'll go with the classic report hack, I thought.

    AEC: I'll try the plugin and report back on the question if I can get the links to work.

    The plugin code is clear and simple. However, the links generated HTML text in the query as:

    ...
    '' || apex_escape.html(ename) || '' employee
    ...
    

    does not work out of the box as the plug-in is escaping in HTML output column values:

        -- Render all other columns
        FOR j IN 3 .. l_value_list.count
        LOOP
          sys.htp.p('' || sys.htf.escape_sc(l_value_list(j)(i)) || '');
        END LOOP;
    

    This can be changed to allow the links:

      -- Render all other columns
        FOR j IN 3 .. l_value_list.count
        LOOP
         IF l_value_list(j)(i) not like '' || l_value_list(j)(i) || '');
        END LOOP;
    
  • Windows Vista does not connect me to my profile to the user even after put my password

    My laptop turns off to be in an idle state for an hour... it is ususally. I am generally able to reboot my laptop, but this time, at the start of Windows Vista enabled me to connect to my user profile. I typed my password correctly and countless times and it is not always connect. I tried to connect through the admin prfile and he has not yet let me ride. Safe Mode boot made no difference because I need to access my files. How can it be solved soon? !!!

    Maybe the Startup Repair tool would help:

    Repair Windows Vista using Startup Repair - http://www.bleepingcomputer.com/tutorials/tutorial148.html MS - MVP - Elephant Boy computers - Don ' t Panic!

  • Firefox plugin process takes all of the memory even if adobe flash is not installed and within the browser are disabled all java plugins is disabled. Why? NSA?

    Only a force quite, from the actual process of activity monitor, will do.

    Mac OS 10.6 Firefox stable and beta, oh, it lasts for months.

    Today is April 12, 2014

    Hello asthedogbarks, please create a new firefox profile and see if the problem exists.

    Thank you

  • Problems to import still Images; Convert all in the SAME Image

    Hello

    I am new to Adobe first CS_5 (usually use of the CPF).  I have problems to import still images.  Even if the images are all different and have unique names (I'm importing .jpg), every time I have import the images that they ALL convert the image even when I drag them to my timeline.  So, when I look in the project - any image area, I click on, they are all the same (but with their original names).  Anyone know WHY this happens and how I can fix this problem?  For the life of me, I can't understand it.  Thank you in advance for the noob.

    Kalei

    It's definitely weird! What are the names of the jpg files? The only thing I can think is that if they have the same base with sequential numbering name, then perhaps they are imported into several instances of the same sequence of image.

  • Not able to see the members of the hierarchy replacing Smartview for database planning

    Hi all

    I'm not able to see the other hierarchy in smartview for the planning application which connect smartview is planning (installation is the hierarchy)

    svh.JPG

    However, I was able to learn the other hierarchy via smartview with essbas connection

    svhe.JPG

    and I have also able to see through a web planning structure.

    Help, please

    Kind regards

    VT

    Yes, it is a known problem in Hyperion planning. If you are drilling on the grid itself, it will show however.

    Mark the thread as correct if that is what you are looking for.

  • What happens if the PC I just downloaded Itunes on & connected to, does it display not all devices?

    What happens if the PC I just downloaded Itunes on & connected to, does it display not all devices?

    Hello 2sealadies!

    Thank you for joining the communities Support from Apple! Looks like you have a problem with your iTuens on Windows 10 not to recognize your iPhone. I know how important it is that the iPhone is recognized by iTunes. Read this article with steps If iTunes does not your iPad, iPhone or iPod. Specifically, after the first series of measures:

    If you are using a Windows PC

    1. Open Device Manager by following the steps for the version of Windows that you have:
      • Windows 10: Click the search box in the lower left corner, type Device Manager and press ENTER. In the list under Bus USB controllers, find the Apple Mobile Device USB Driver.
      • Windows 8: loose in the right edge of the screen. Press search and enter the Manager devices, and then click Device Manager. If requested, enter your password. In the list under Bus USB controllers, find the Apple Mobile Device USB Driver.
      • Windows 7: click on > Control Panel > system and Maintenance > Device Manager. If requested, enter your password. In the list under Bus USB controllers, find the Apple Mobile Device USB Driver.
    2. Even if you do not find the Apple driver, follow the steps below, based on what you see or don't see.

    The pilot and
    No symbols

    A down arrow
    by the driver

    Exclamation or
    question mark by
    the pilot

    No Apple Mobile
    USB device driver

    You don't see symbols next to the Apple Mobile Device USB Driver

    If you do not see , , or of the Apple Mobile Device USB Driver, look for third-party software conflicts. Then if you still need help, restart your Apple Mobile Device Service or contact Apple technical support.

    You see an arrow down

    If you see next to the Apple Mobile Device USB Driver, the driver with the right mouse button and choose enable from the context menu. Then if you still need help, contact contact Apple technical support.

    You see an exclamation point or question mark

    If you see or the Apple Mobile Device USB Driver, right click on the entry, then manually update the Apple Mobile Device USB driver.

    You do not see the Apple Mobile Device USB Driver

    1. Disconnect your device from your computer.
    2. Save a screenshot by pressing the Home button and sleep/wake button of the device button at the same time. The screen should Flash briefly.
    3. Reconnect your device to your computer.
    4. If you see one of these sections in the Device Manager, expand them:
      • Imaging devices
      • Other devices
      • Portable devices
      • USB Bus controllers

    Now, locate the entry that recognizes the device as a camera. You should see 'Apple IPhone', 'Apple iPad' or 'Apple iPod '. Right-click the device entry, and then manually update the Apple Mobile Device USB driver.

    If a single unknown device appears, follow these steps:

    1. Right click on the unknown device entry.
    2. Choose Properties from the context menu, and then click the Details tab.
    3. In the drop-down menu, select hardware IDS.
    4. If the ID begins with something other than USB\VID_0000 & PID_0000, go into the Device Manager and right click on the entry for device unknown, and then manually update the Apple Mobile Device USB driver.
    5. If the ID begins with USB\VID_0000 & PID_0000, then follow the remaining steps.
    6. Unplug the unit and remove all the USB devices on the computer.
    7. Shut down the computer, and then turn it back on.
    8. Reconnect the device, tests of each USB port for about 30 seconds to see if the device is recognized.
    9. Test with a different, checked 30-pins-USB or the lightning-connector-cable-USB, if they are available.

    If you still need help, contact Apple technical support.

    Manually update the Apple Mobile Device USB driver

    If one of the sections above directs you to this section, you should already have right click on an entry in the Device Manager. Now, follow these steps:

    1. Choose update driver software.
    2. Choose "Browse my computer for driver software."
    3. Choose "Let Me pick from a list of drivers for devices on my computer.

  • Click the disk button. If this is not available, choose a category of devices such as Mobile phone or storage device, if in the list.
  • Click Next. You should see the disk button.
  • Click Browse and navigate to C:\Program Files\Common Apple Mobile Device Support\Drivers.
  • Double-click the file "usbaapl. If you have a 64-bit version of Windows, this file will be called "usbaapl64". If you do not see here "usbaapl64" is not a Drivers folder, look in C:\Program Files (x 86) \Common Files\Apple\Mobile Device Support\Drivers.
  • In the disc window, click Open, and then click Next and then click Finish.
  • Windows installs the driver. If a message indicates that the software that you install "not passed the Windows Logo test", click on continue. You can get help with other common errors and the error code numbers in this Microsoft article.
  • Open iTunes to make sure that iTunes recognizes your device. If not, Restart the Apple Mobile Device Service.
  • See you soon!

  • Within the last week, I am unable to connect to the Bank of America Online banking. I followed all of the preliminary recommendations to the best of my abilities but the problem persists. BofA first told me it was a compatibility problem, they had some w

    I can not connect on the site Web of Bank of America since Firefox. This problem started recently. BofA said the first they have a compatibility issue with the new version of Firefox. Then they say no, it's a Firefox problem. I tried the solutions listed in the prior discussions but none work. I have no problem connecting to BofA via IE.

    URL of affected sites

    http://www.bankofamerica.com

    I solved my problem by disabling an extension add-on from microsoft
    Go to tools on the memo of firefox, then the "addon" then "extensions."
    If you have an add on extension "Microsoft.NET Framework assistant 1.2.1... disable and see if you can now connect to Bank of america"

  • "The connection has expired" continues to display until all the few minutes for a few min then I can surf again

    Three days 'connection timed out' appears all the minutes for any site I visit and then he disappeared and I can access the sites. I've tried everything described in Mozilla support on this issue as the browser any cookies and deletion history, flushing DNS, uninstall / removal of modules, Firefox update, uninstall and reinstall Firefox, etc, but nothing worked in all and now even after formatting my system, the error is still there.

    Everything worked fine before and what is happening in my pc only. In the laptop I can access any site at any time without a problem.

    Please help me.

    Disabling ipv6 did the trick.

  • 5740 OfficeJet All in One: 5740 printer OfficeJet connects but scanner is not on the wireless network.

    Hello

    I recently bought the above printer and the printer connected most of the time, the scanner becomes more reluctant on my wireless network.

    I just printed a document yet when I try to analyze only one or two seconds later I said it has not detected to scan. I don't know how the device connects - but because the printer connects OK probably is not a wireless connection / router issue?

    The only solution I found to this problem is to restart my system which is quite frustrating and not an acceptable response to long term. When I do this the scanner seems to operate normally, at least for a while.

    I installed all the software from the Web site, including the HP utility - yet I am also told that "computer scan can not be activated" because the software is not found - which is strange, because I installed all the software available.

    Any suggestions?

    Hey there @gggdfsdfsdaf!

    Thanks for posting on the HP Forums!

    I would be happy to provide you with some suggestions on the 5740 Officejet and its communication of scanning.  There may be a slight problem with the software.  I suggest you uninstall the HP software.  Once the software uninstalled I recommended to perform a "repair disk permissions" on your Mac.  A repair disk permissions is a utility built into the operating system Mac designed to detect and resolve problems or errors. After that permission to repair disc is finished, reboot your Mac computer and re-install the software.

    To uninstall the HP software, click: uninstall the HP software

    To perform a repair authorization disk click here: repair disk permissions

    To download the Officejet 5740 software, click here: 5740 Officejet full feature and driver software

    After the installation I recommend that you check the software updates on the Mac.  To search for software updates, click the icon "Apple" to the left and click on the "app store".  In the app store, you can click on the "updates" at the top of the window.  Updates install and Hp or a printer.  After the update, you must restart the computer.

    You can also launch scans of an application on the mac, called 'Image Capture'.  For Image Capture click "Spot Light" (magnifying glass) in the upper right of the Mac.  Image capture type and it should appear as one of the first options.  Open Image capture and on the left side of the window should display your scanner.  The scanner can be listed under 'shared '.  Select your scanner and you should have the options and settings on the right side for scanning.

    Please post back and let me know if this worked for you!

  • BlackBerry Smartphones Blackberry Media Sync continues to display 'Please connect a Blackberry smart phone' when the Blackberry Storm is connected to the PC

    About a 2 months ago when I would like to connect my (the first storm) blackberry storm to my computer via the USB cable supplied with the phone, I was able to transfer music from my computer (itunes) to the blackberry via Blackberry Media Sync with no problems (open Blackberry Media Sync, connect blackberry to the computer via the USB port and screen Media Sync would change so that I could sync to the blackberry storm music). I didn't even have to install Blackberry Media Sync in December 2009

    But now after I connect my Blackberry Storm to my computer, the screen of Blackberry Media Sync does not change and continues to display "please connect a Blackberry smartphone. I tried these tips I found online:

    1.) several reboots my computer (windows vista)

    2.) update/reinstall Blackberry Media Sync, then by restarting my computer

    3.) reconnection from blackberry to the computer, then open Media Sync

    4.) Open Media Sync first and then connect the blackberry to the computer.

    5.) installation BlackBerry USB and Modem drivers (even if I can't find the USB driver for it under the Universal Serial Bus Controller when I check in the Device Manager when you go to control panel – system and Maintenance – Manager of devices, but I found a v2 COM4 and COM5 RIM virtual serial Port when you select "devices by connection" under display in Device Manager) or are RIM Serial Port virtual v2 COM4 and COM5 drivers I'm looking for?

    6.) go to Options (on blackberry) - memory and make sure Media Card Support, Media Transfer Protocol (MTO) and Mass Storage Mode Support are resolved on 'On', the encryption Mode is set to 'None' and mass storage Mode Auto activate when connected, it the value "Prompt" although I tried to 'Yes' as well. It says I have 785 MB of memory space of the unit out of 879 MB total memory of the device and 7.1 GB of free space on a total of 7.3 GB of Media Card Media Card.

    None of the above tips and troubleshooting tips worked. I also checked the Blackberry technical solution center but I've not found anything there that has contributed to the other. I found discussions forums online, including issues of people with 'blackberry media sync cannot connect to the device' pop up, but I have not had this pop-up. The Media Sync screen remains just the same as if I never connected the blackberry storm to my computer in the first place even if my blackberry storm recharges via the computer.

    Is there something that I miss or have not yet done? What should I do?

    Too bad. I went to a Verizon store and they me remove the battery and turn the blackberry. Worked like a charm and I can now use Media Sync.

    Also told me that I need to update the software of the phone blackberry using Blackberry Desktop software (I have version 4 and need to update to 5) and make sure to choose to back up files when you are prompted during the update or you will lose all files, the media and info saved on blackberry.

Maybe you are looking for