Need help in updating a hierarchy

I have a table T1 which has the following columns:
Emp_ID - varchar
Mgr_ID - varchar
One EmpID can have only one Mgr ID,
One MgrId can have multiple EmpID.
Emp_ID can be Mgr_ID for some other Emp_ID.
I need to write a code in which I have to edit all the rows for the subsequent employee IDs for a manager. For example:
Emp_ID Mgr_ID
A C
B C
C D
D F
E D
F F
G B
H G
If I take an ID "C", then the code should return A, B,  G and H (all the subsequent IDs in the hierarchies which have A as the topmost node).
There is no limit to this depth of the hierarchies, and can be increased/decreased dynamically from the UI.
Can anyone please guide me and tell me how to achieve this?
Thanks

Emp_ID Mgr_ID
A C
B C
C D
D F
E D
F F
G B
H G
How do you identify the topmost level in your hierarchy ?
Thanks and regards, Rishabh K

Similar Messages

  • HT201541 I need help with updating my browser.

    I need help with updating my browser.  Its telling me that Safari is outdated.

    That is a very old version belonging to Snow Leopard. I take it you are not actually running Yosemite.
    Upgrading to Yosemite
    You can upgrade to Yosemite from Lion or directly from Snow Leopard. Yosemite can be downloaded from the Mac App Store for FREE.
    Upgrading to Yosemite
    To upgrade to Yosemite you must have Snow Leopard 10.6.8 or Lion installed. Download Yosemite from the App Store. Sign in using your Apple ID. Yosemite is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
        OS X Mavericks/Yosemite- System Requirements
          Macs that can be upgraded to OS X Yosemite
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
             7. Xserve (Early 2009) - Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.

  • HT4623 I need help ASAP updating my jailbroken iPod touch 4th generation

    I have a 4th generation iPod that's jailbroke by Cydia, I need help to update it to IOS 6. From my ipod

    You can't, over-the-air update did not become available until iOS 5, you show iOS 4.1.
    And we cannot discuss jailbroken devices here per the moderators.

  • Please i need help i updated my iphone 3gs and now its not activating

    i need help i updated my iphone 3gs and now its not activating

    What happens when you try to activate the iPhone?
    If there is an error message, what is the exact wording of that message?

  • Need help for Update and cancel SalesOrder

    Hi All,
    I  written java code for create sales order based on salesquotation,now i want to update and cancel sales order ,i need help to update and cancel salesorder.
    can give any related links for update and cancel salesorder.
    Thanks and Regards,
    Srinivas

    Hi srinivas.L
    It is simple, here is some sample code. You must use getbykey to get the document. Then once you got it you can make whatever changes you need. Then update it. where i have oOrder.Update() you can have oOrder.cancel
    Dim oOrder As SAPbobsCOM.Documents
            oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            If oOrder.GetByKey(530) Then
                oOrder.Lines.SetCurrentLine(1)
                oOrder.Lines.WarehouseCode = "01"
                If oOrder.Update() <> 0 Then
                    MsgBox(oCompany.GetLastErrorDescription)
                End If
            Else
                MsgBox("Nothing found")
            End If
    Hope this helps

  • Dataguard - logical standby - need help - not updating data at commit

    Hi
    Need help ?
    We have logical standby setup where data is not updated at standby when committed at Primary. It only updates when alter system swith logfile.
    On Primary:
    log_archive_dest_2='service=xxStandby LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=xxStandby'
    On Standby:
    we have already created standby redo logs ( 1+ # redo logs)
    we used ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE NODELAY;
    The data only ships when we do the ALTER SYSTEM SWITCH LOGFILE whereas it should so when data is commited on the primary.
    Is there anything we are missing or need attention.
    Please help
    Thanks you so much

    Yes, I have standby redo logs = ( 1 + # redo logs on the primary) and are of same size.
    I also changed the log_archive_dest_2 setting for valid_for to ALL_LOGFILES, but the performance is still very slow... we are now overr 9 hrs behind the primary.
    log_archive_dest_2='service=xxStandby LGWR ASYNC valid_for=(ALL_LOGFILES,primary_role) db_unique_name=xxStandby'
    The Logical standby performance reallly not good at all. trying to increase sga/pga more ... hoping this will speed up some
    Paul

  • I need help with updating my Ipod 5

    So i am updating my ipid 5 to IOS 7.0.3. I am doing it through Itunes on my computor. I have sucsessfully updated the ipod, and am now in the process of setting up the ipod after the update. I am connected to wif-fi, but for the past 20 hours all the ipod has said was "restoring ICloud settings". I need help! i dont know what to do
    Thanks!

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - The try again.

  • Need help regarding updated rows

    Dear sir,
    need help on this query
    how many rows got updated when i execute an update statement

    If you are executing update statement from sqlplus session.
    Make sure "feedback" is turned on. It'll show numbers of rows updated just after the command;
    SQL> update tt1 set col1 = 1;
    0 rows updated.
    SQL> show feedback
    FEEDBACK ON for 1 or more rows
    SQL> set feedback off
    SQL> update tt1 set col1 = 1;
    SQL>Details about this sqlplus system setting:
    FEED[BACK] {6|n|OFF|ON}
    Display the number of records returned (when rows >= n )
    OFF (or n=0) will turn the display off
    ON will set n=1
    Regards,
    Ullhas

  • Need help in UPDATE data in SQL Query

    Hi all,
    I am trying to update data in the sql table as per below screenshot but couldn't able to do it. Can anyone help to update the data as I mention in screenshot.Appreciate you help.Thanks.
    Yellow highlighted columns are source
    Green highlighted columns are target
    Colored data should be update as per source data in sql table.Data is not static as it might have more rows to update and query should be bit dynamic.
    Maruthi...

    You have already asked this question once. You did not get any good answers, because you the information you gave was insufficient. And I'm afraid that the information is still in sufficient.
    Or more exactly, from the example you have given, the answer is: can't be done. And the reason it can't be done, is as I explained in response to you first thread: there is no information in the data to from which we can deduce that Clorox Company
    should be under "Week 1-1,K.B,F". The fact that rows are listed in a certain order in the screenshoot is of no importance, because a table is an unordered object.
    But you said in another post that you have a timestamp column. Maybe that column is usable - maybe it is not. But at least it is a key that you have more columns that the ones you show.
    The best way to get help with this type of problems is to post:
    1) CREATE TABLE statement for your table(s).
    2) INSERT statements with sample data.
    3) The desired result given the sample.
    4) A short description of the actual buisness problem you are trying to solve.
    5) Which version of SQL Server you are using.
    This makes it easy to copy and paste into a query window to develop a tested solution. Screenshots with an insufficient amount of data is not going to help you very much.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • MAC OS 10.6.8 Using Safari 5.1 Needing Help With Updating Adobe Flash

    Hello-
    Recently Adobe Flash installed an icon in my System Preferences and when I click the icon there are several tabs.  One allows updates to check automatically.  It says it will install the latest version of Flash without having to remove the previous version, but I have never been told that a newer version is available unless I clcik "check now."  although "Check for updates automatically" is checked, I do not know where it tells me a newer version is available.  Also, there has been 5 "newer versions" available since this icon was installed in System Prefeences, I have only found out about the newer versions when I clicked "Check Now."  If I read that with this new way to install the latest Mac version of Flash does not require me to uninstall the previous version of Flash how do I install the most recent version of Flash?  Does it come in an email?
    Since it is not telling me that there is a more recent version of Flash unless I click "Check Now" should I still do it the way I used to install the latest version of flash?  (The way before this icon was added to System Preferences)?
    I would appreciate help with updating Flash to the most recent version.  I used to uninstall the older version, restart the browser and download the most recent version and install it.  It always worked find but this was before there was an Adobe icon in my system Preferences.

    Hello,
    The way you used to do this (uninstall, restart the browser, etc.) is still definitely valid and probably the "safest" way to get a new version installed.  Uninstalling shouldn't be required, but it definitely doesn't hurt.  If you feel comfortable doing it the old way, please feel free to continue using that process.
    As for notifications, this is a bit trickier, but in general you should be notified within 30 days (or so) after a new player is released.  This usually occurs when the browser loads swf content.  Clicking the button will, like you mention, immediately check.  Another alternative to finding out when a new player is released is to subscribe to our Flash Player Releases feed.
    Is there a way to be automatically notified when a new Flash Runtime release is made?
    Thanks,
    Chris

  • Need Help to update the labels in the GUI syncronously - Swing application

    Hello everyone,
    I need some help regarding a swing application. I am not able to syncronously update the counters and labels that display on my Swing GUI as the application runs in the background. But when the running of application is completed, then the labels on the GUI are getting updated, But I want update the labels and counters on the GUI syncronously as the code executes... below I am giving the format of the code I have written..............
    public class SwingApp extends JFrame{
            // here i have declared the label and component varibles like...
                      private JTextField startTextField;
           private JComboBox maxComboBox;
           private JTextField logTextField;
           private JTextField searchTextField;
           private JLabel imagesDownloaded1;
           private JLabel imagesDownloaded2;
           private JLabel imagesDidnotDownload1;
           private JLabel imagesDidnotDownload2;
                      private JButton startButton;
    //now in the constructer.............
    public Swing(){
    //I used gridbaglayout and wrote the code for the GUI to appear....
    startButton = new JButton("Start Downloading");
        startButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try{
                 actionSearch();   //actionSearch will contain all the code and the function calls of my application...........
            }catch(Exception e1){
                 System.out.println(e1);
        constraints = new GridBagConstraints();
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 5, 5);
        layout.setConstraints(startButton, constraints);
        searchPanel.add(startButton);
    //update is a function which initiates a thread which updates the GUI. this function will be called to pass the required variables in the application
    public void update(final int count_hits, final int counter_image_download1, final int didnot_download1) throws Exception{
         Thread thread = new Thread(new Runnable() {
             public void run() {
                  System.out.println("entered into thread");
                  System.out.println("the variable that has to be set is " + count_hits);
                  server_hits_count.repaint(count_hits);
                  server_hits_count.setText( " "+ Integer.toString(count_hits));
                  imagesDownloaded2.setText(" " + Integer.toString(counter_image_download1));
                  imagesDidnotDownload2.setText(" " + Integer.toString(didnot_download1));
                  repaint();
         //this.update(count_hits);
         thread.start();
    //Now in main............................
    public static void main(String[] args){
    Swing s = new Swing();
    s.setVisible(true);
    }//end of main
    }//end of class SwingAbove I have given the skeleton code of my application........ Please tell me how to update the GUI syncronously...
    Please its a bit urgent...............
    Thank you very much in advance
    chaitanya

    First off, note that this question should have been posted in the Swing section.
    GUI events run in a separate thread (the AWT / Event Dispatch Thread) than your program.
    You should be invoking AWT/Swing events via SwingUtilities.invokeLater().
    If for whatever reason you want to have the program thread wait for the event to process
    you can use invokeAndWait().
    http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html

  • HT4623 Need help to Update my Ipad2 please

    hello um i have a problem i'd like to update my Ipad2 but i don't have the "Software Update " Botton...what can i do? please help me :/

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.1.3. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
    Tip 2 - If you're updating via wifi, place your iPad close to your router to preclude getting a corrupted download.
     Cheers, Tom

  • Need help in updating Inco terms 1 and 2 in the Inbound delivery creation

    Hi Group,
    I have created an output type that will be triggered before an Inbound Delivery is created from the Outbound Delivery ( this scenario is in STO orders - Inter company stock transfer process ).
    I have copied a standard processing routine and customized it but, I am not able to update the 2 fileds (INCO1 and INCO2) in the item delivery of the Inbound Delivery. I was using the FM 'WS_DELIVERY_UPDATE' to update these 2 fields( by passsing the values fetched from the Outbound Delivery into the structure 'vbkok_wa' and the Inbound delivery created into the field 'delivery' of the FM ).
    When I run the the FM this is giving me errors and thus no Inbound Delivery is getting created.
    Please suggest me with some other way of updating these fields in the Inbound Delivery.
    and one more thing is that, I was selecting the Inco terms from the table LIKP directly, but this should not be the proper way to read the Incoterms, so please suggest me a way to read these 2 fields from the Outbound Delivery.
    to summarize, I need an FM to get the Incoterms from Outbound Delivery initially, and then, require another FM to update these Incoterms in the Inbound Delivery( this is a typical scenario in an STO - Stock Transport Order ).
    Please let me know your input on these 2 cases.
    Thanks for the help in advance.
    Regards
    Vishnu.

    Hi Group,
    By implementing the BADI 'LE_SHP_DELIVERY_PROC' this particular requirement can be fulfilled.
    Regards
    Vishnu.

  • Need help with update statement with multiple joins

    I've got the following select statement that is pulling 29 records:
    SELECT
    PPA.PROJECT_ID,
    PPA.SEGMENT1,
    peia.expenditure_item_id,
    peia.expenditure_type,
    pec.expenditure_comment
    FROM PA.PA_PROJECTS_ALL PPA,
    pa.pa_expenditure_items_all peia,
    pa.pa_expenditure_comments pec
    where PPA.segment1 < '2008' and
    PPA.project_id = 52 and -- just run for project # 20077119 for testing
    peia.expenditure_type = 'PAYROLL' and
    peia.project_id = ppa.project_id and
    PEC.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID;
    I need to update the pec.expenditure_comments to a static field for those 29 records. I assume I should start with the following, but not sure how to complete the where:
    update
    pa.pa_expenditure_comments pec
    set pec.expenditure_comment = 'REFERENCE HD#728'
    where
    First time that we've ever needed to update, so any and all help appreciated.

    Try using exists:
    update pa.pa_expenditure_comments pec
    set    pec.expenditure_comment = 'REFERENCE HD#728'
    where exists ( select null
                   from   pa.pa_projects_all ppa
                   ,      pa.pa_expenditure_items_all peia
                   ,      pa.pa_expenditure_comments pec2
                   where  ppa.segment1 < ''    -- not sure what you posted here, so for next time:
                                               -- please put your examples between the code tags.
                   and    ppa.project_id = 52  -- just run for project # 20077119 for testing
                   and    peia.expenditure_type = 'PAYROLL'
                   and    peia.project_id = ppa.project_id
                   and    pec2.expenditure_item_id = peia.expenditure_item_id
                   and    pec2.expenditure_item_id = pec.expenditure_item_id
                 );

  • Desperately Need Help - Cannot Update or Install Software

    have an iMac Intel Core 2 Duo running on Mac OS X 10.6.4  I can't update existing software or install new software.  Every time I try the installation either does not occur (e.g. for the Mac OS X software or iTunes where the install occurs with a re-start) or gets hung up a the last stage of the installation.  I have a time capsule as well so am wondering if I should just reinitialize the whole system.  I've already tried creating a new administrator and installing updates from there but that does not work either.  PLEASE HELP

    I've already tried creating a new administrator and installing updates from there but that does not work either.
    Phil...
    So it's a system wide issue.
    How much free space on the startup disk?
    Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. Make sure you always have a minimum of 15% free disk space.  Freeing Up Hard Disk Space - Mac Guides
    Probably a good idea to run Disk Utility and check to see if the startup disk needs repairing > Using Disk Utility to verify or repair disks

Maybe you are looking for