find the value relative to another column

Find the value column B in the column 'sparent. Let me explain the few cases:
Suppose that we receive the 1000 kg of quantity for Jack, Jack then transferred this 1000 kg to Robin and Robin transferred once again this amount to Parkins and so on. A column named Type records the entry type, either it's a receipt or transfer operation. His entry would be recorded in my table like:

QTY_ A_ B_ Type_
Reception of 1000 Jack
1000 jack Robin transfer
Transfer of 1000 Robin Parkins

So, with this information, you find the parent of Parkins, Jack, receipt of Type?
with t as (select 1000 qty,null a,'jack' b,'receipt' type from dual
             union all
               select 1000,'jack','robin','transfer' from dual
               union all
               select 1000,'robin','','transfer' from dual
               union all
               select 1000,'parkins','jack','transfer' from dual)
    select *
      from t
      where connect_by_isleaf = 1
      and a is null
      connect by nocycle b = prior a
     start with b = 'jack' ;

       QTY A       B     TYPE
---------- ------- ----- --------
      1000         jack  receipt
1 row selected.

Good bye
DPT

Tags: Database

Similar Questions

  • How to find the value duplicate of each column.

    I have it here are four columns,
    How can I find the duplicate of each columns value.

    with All_files like)
    Select ' 1000 'like BILL, "2000" AS DELIVERYNOTE, CANDELINVOICE ' 3000', '4000' CANDELIVERYNOTE of all union double
    Select ' 5000 ', ' 6000', ' 7000 ', ' 8000' Union double all the
    Select '9000 ', '1000', '1100',' 1200' from dual union all
    Select ' 1200 ', ' 3400', ' 6700 ', ' 8790' Union double all the
    Select ' 1000 ', ' 2000', ' 3000 ', ' 9000' Union double all the
    Select '1230', '2340', ' 3450 ', ' 4560' double
    )
    SELECT * from All_files


    Output should be as shown below.

    1000 2000 3000 4000
    9000 1000 1100 1200
    1200 3400 6700 8790
    1000 2000 3000 9000

    Required to check uniqueness columns.

    Thank you.

    Hello

    If you are not too concerned about performance, this should give you the desired result:

    SELECT distinct INVOICE, DELIVERYNOTE, CANDELINVOICE, CANDELIVERYNOTE
    FROM (
      SELECT a.*,
             count(*) over(partition by t.column_value) cnt
      FROM All_files a,
           table(
             sys.odcivarchar2list( a.INVOICE
                                 , a.DELIVERYNOTE
                                 , a.CANDELINVOICE
                                 , a.CANDELIVERYNOTE ) ) t
    )
    WHERE cnt > 1
    ;
    
  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • How to find the value dated the same day in the last year

    I want to know how to find the value dated the same day in the last year.

    I use now, there is the function with the year and the result is

    Year Rev There are Rev
    20113000
    201240003000
    201320004000
    201450002000

    It works but it's not that I want. I'm trying to add the column date (Ex.20140101) in my report but it'snot work.

    I want to show:

    Date Rev There are Rev
    20110112200
    20120112100200
    20130112300100
    20140112500300

    If use (< degree >, < time_dim >. < date >, 365), it works but does not correct 100%

    Please help me...

    Thank you very much

    Check this link cool - bi.com

  • Find the value of MessageStyledText

    Hello

    I have a field (Dates of expenditure) typed MessageStyledText and the value of this files is 29/04/2011 - 29/04/2011 i.e. ' expense date 29/04/2011-29/04/2011.

    I need to remove "-29/04/2011"because the date is written twice in that filed and client wants the date filed only once in that. " So I have to delete the other date. I am dointg the same substring function but cannot get the value of messagStyledText bean.

    In the controller, I wrote-


    OAMessageStyledTextBean MessageStyledTextBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("ExpenseDates");

    String ValueMessageStyledText1 = (String) MessageStyledTextBean.getValue (pageContext);

    String ValueMessageStyledText = MessageStyledTextBean.getText (pageContext);

    But I have not been messageStyledText.

    I am unable to file viewattribute on this page and Jdeveloper so that I can get the value of messagestyledtext through VO.

    Y at - it a function to find the value of messsagestyledtext for that I make my requirement fruther.

    Thank you
    Amit Jaitly

    Another way, I can suggest is to make the existing bean made false and create a new bean MessageStyledText and check the logic seeds while to get 1 one and together these in extended controller.

    Thank you
    -Anil
    http://oracleanil.blogspot.com/

  • Find the minimum date on multiple columns

    Hello

    I have two questions to find the minimum date on several columns:
    1. need a select query that should JOIN two tables and return any information (CASSEDTL) table with minimum date out of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE.
    2. need of an update query that should update all cases in the CASEDTL table with the minimum date of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE.

    The DDL:
    CREATE TABLE CASEMSTR 
    (   CASENBR     NUMBER,
        DATEISSUED  DATE,
        DATEPLACED  DATE,
        DATEENTERED DATE);
        
    CREATE TABLE CASEDTL 
    (   CASENBR     NUMBER,
        STATDATE    DATE,
        RCVDATE    DATE,
        MODDATE     DATE);
        
    INSERT INTO CASEMSTR VALUES (1, '1 JUL 2007', '1 JUL 2007', '12 JUL 2007');
    INSERT INTO CASEMSTR VALUES (2, '1 JAN 2008', '1 JAN 2008', '21 JAN 2008');
    INSERT INTO CASEMSTR VALUES (3, NULL, NULL, '3 DEC 2008');
    INSERT INTO CASEMSTR VALUES (4, '31 MAR 2009', NULL, '6 APR 2009');
    INSERT INTO CASEMSTR VALUES (5, NULL, '22 MAR 2009', '6 APR 2009');    
    INSERT INTO CASEMSTR VALUES (6, NULL, NULL, '16 JUL 2009');
    INSERT INTO CASEMSTR VALUES (7, '1 DEC 2008', '7 DEC 2008', '26 DEC 2008');
    INSERT INTO CASEMSTR VALUES (8, NULL, NULL, '17 MAY 2009');
    
    INSERT INTO CASEDTL VALUES (1, '25 JUN 2007', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (2, '1 JAN 2008', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (3, '11 NOV 2008', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (4, '31 MAR 2009', NULL, '2 AUG 2009');
    INSERT INTO CASEDTL VALUES (5, '19 JUL 2009', NULL, '2 AUG 2009');    
    INSERT INTO CASEDTL VALUES (6, '13 JUN 2009', NULL, '16 JUL 2009');
    INSERT INTO CASEDTL VALUES (7, '7 DEC 2008', NULL, '16 JUL 2009');
    INSERT INTO CASEDTL VALUES (8, '14 MAY 2009', NULL, '16 JUL 2009');
    COMMIT;
    The initial query I have is
    SELECT CD.CASENBR, CM.DATEISSUED, CM.DATEPLACED, CM.DATEENTERED, CD.STATDATE, CD.RCVDATE, NULL "NEW RCV DT" 
    FROM CASEDTL CD
        INNER JOIN CASEMSTR CM
            ON CD.CASENBR = CM.CASENBR;
    Need to know what is the best way to complete the new Date of RRS? Receive a new date should be the minimum date of DATEISSUED, DATEPLACED, DATEENTERED and STATDATE. And also how do I write an update statement unique to upade date of receipt in the detail table?

    Any help would be appreciated! Thanks in advance!

    Where is the function LESS? Refer to manual SQL.

    HTH - Mark D Powell.

    put1 > desc multdate
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     COL1                                               DATE
     COL2                                               DATE
     COL3                                               DATE
    
    put1 > select * from multdate;
    11-AUG-09 10-AUG-09 01-AUG-09
    
    put1 > select least(col1, col2, col3) from multdate;
    01-AUG-09
    

    Published by: MarkDPowell on August 11, 2009 15:53 added example

  • I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    Click the triangle next to the Inbox to view the Inbox for each account. Then select the desired mailbox and the information will be displayed in the upper part.

    You are entitled to 90 days telephone support from Apple. Try to contact them.

    Apple Support contact

    Apple Support by email or chat

    Contact Apple Support - phone

  • How to find the value closest in the table?

    Hi all

    I just want to find the value closest from the string table. That I joined herer as an image.

    Now, if I want to find the value of 350 of the string table and that's not in the table in the output array there should be more close 350 display value...

    Thank you for the support

    Vinal Gandhi

    Hi G Vinal,

    something like the joint comes to my mind.

    It may be useful

    Mike

  • Look for the logic find the value of m and c of this equation y = mx + c.

    Hello

    I have 4 points for example = 3.38276, 0.375866 xi

    Yi = 3.37749, 0.281924

    using this tip, I want to find the value of m and c.

    You please suggest me some logic to solve this equation using labview programming.

    I tried with one solution, but in this case I do not have the correct answer. Here as an attachment, there is vi help I tried to solve my equation, but in this case the value that never got as a response it is dissatisfied with the equation, means if I replace the value of m and c eqation then it must be L.H.S = R.H.S, but I don't have the right solution.

    You please guide me.

    Thank you very much.

    Why do you think that the results are incorrect? I put your numbers in your code and the result on a XY Chart Wescott, I then bunk which with more than 20 values with a value ranging from 0.6 to 3.2 x and use factors calculated in your code to generate values of Y. The two overlap almost exactly...

    Mike...

    BTW: There is a linear adjustment integrated into LV VI

  • Where can I find the value of ss_nm_jvm_startup_properties?

    Hello

    I am trying to reset the password for the user weblogic using the document Doc-ID 1949675.1

    I am stuck at step 4

    B. start AdminServer:

    Java $ < s_nm_jvm_startup_properties > - Dweblogic.system.StoreBootIdentity = true - Dweblogic.Name = AdminServer weblogic. Server

    Where:

    < s_nm_jvm_startup_properties > is the same as the variable value of context ss_nm_jvm_startup_properties

    Where can I find the value of s_nm_jvm_startup_properties.

    I searched the support site and google it without any result.

    I'm new in EBS and try to upgrade the EBS 12.2.0 to 12.2.4

    Thank you

    Salman

    Hello

    Application contextfile $INST_TOP/appl/admin find the setting "nm_jvm_startup_properties".

    grep nm_jvm_startup_properties context_file.xml

    Thank you

    A H E E R X

  • To find the value of a dynamic element to session state,

    Hi all

    Is it possible to find the value of an item in the session state, but the name of the element is stored in a variable
    as

    APEX_UTIL. GET_SESSION_STATE (v_variable)

    where v_variable would be the name of the element?

    Thanks in advance,
    RD

    You describe the default feature?
    http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21676/apex_util.htm#CHDEJEJE

    DECLARE
      v_variable  VARCHAR2(20) := 'P1_ITEM';
      v_value     VARCHAR2(255);
    BEGIN
      v_value := APEX_UTIL.GET_SESSION_STATE (p_item => v_variable);
    END;
    

    I missed something?

  • Find the value of the item required using getVariableData

    Hi all

    I have a bpel in which the variableentree is of type anyType. So, I'll get any XML as input to any schema. In all the XMLs, I have a common element called XMLname which is of type string. Now I want to find the value contained in this element XMLname, using getVariableData.

    I assigned the payload of the variableentree to OriginalXML called bpel variable that is still of type anyType. This is my requirement that data type be anyType.

    Now if I try to use getVariableData, I wonder to give the partname and the locationpath. I don't know the pattern or the XPath to achieve the XMLname. Because for each xml, it would be different.

    Kindly help me in this regard.

    Thank you
    Sabarisri. N

    Hello

    You can access the exact item (XMLname) using a predicate in your XPath




    Good luck!

    Melvin

  • SQL query to find the value of a column as well!

    Hi all

    I have to write a query that needs to retrieve the value of a column in table B if the column value is Null in the Table A. Please find below the sample table.

    Table A:
    *******
    EmpNumber ID
    ------------------------------
    1 12345
    2
    3 14789
    4
    5 74563

    Table B:
    *******
    EmpNumber ID
    -----------------------------
    1 12345
    2 78451
    3 14789
    4 12212
    5 74563

    In the table a second and third rows have value for EmpNumber. The query should look for table B for EmpNumber value. Please advise me to make this request.

    Thank you

    This?

    select      a.id,
         nvl(a.empnumber,b.empnumber) empnumber
    from tabA a, tabB b
    where a.id = b.id;
    
  • AF:Switcher, handfuls of line column values based on another column in the table

    Hello

    I have a question if you can help me on this. It's on af:switcher.

    What I'm trying to do this - is in a table of the adf, based on the value of a column, I want another column to display as a link or not.
    For example, if the status column is 1, then the id column display as a link (I just put a h:outputLink around outputText to do), if it is then show him without bond.

    For this I put two different facets and opportunities switcher to decide what facet of show which line.

    BUT what is happening is that only on opportunities is made. Either / or scenario. It is not made each line according to the value of the status column.

    What is planned.

    I just tried with the dept table.

                    
                    
                    
                      
                    
                    
                    
                        
    
                      
                    
    

    The lines for which the deptno > 20, I wanted to display the pass as link and for the deptno<=20, log="" will="" be="" an="" input="" text.="" it="" works="" fine="" for="" me.="" probably,="" you="" may="" need="" to="" get="" rid="" of="" h:outputlink="" and="" use="" commandlink="" golink="">

    Arun-

  • How to use the value of the column in the old testament even another column in the report

    I have a report based on a query like this

    SELECT
    "AAA."
    'BBB '.
    FROM TABLE2

    and AAA is a NUMBER related to the TABLE1 table. I try in the column attributes writing a correct LOV. In this LOV I have to use a current value of the a.
    Fe SELECT CCC | » '|| DDD FROM TABLE1 WHERE EEE = #AAA #.

    The question is how to get the value of AAA to this query (#AAA # dosent work)?

    the second way to fix this problem I thought changed the first request:

    SELECT
    "AAA."
    "BBB."
    APEX_ITEM. SELECT_LIST_FROM_QUERY
    (2, NULL,'SELECT CCC |) » ''|| DDD FROM TABLE1 WHERE EEE = 'AAA' ') "FFF".
    FROM TABLE2

    but problem is the same... You have a solution?

    THX in advanced for any help

    Hello

    OK, try this

    X_ITEM. SELECT_LIST_FROM_QUERY (1, (SELECT CCC |)) » '|| DDD FROM TABLE1 WHERE EEE = AAA),'SELECT CCC | » ''|| DDD, CCC | » ''|| DDD FROM TABLE1 WHERE EEE =' | AAA, ","NO")"FFF ".

    Concerning

    Paul

Maybe you are looking for

  • How can I automatically run anti-virus for files downloaded from Firefox on Linux (Ubuntu)?

    Double I start my computer with Windows 7 and sometimes download EXEs under Linux to use under Windows. I tried to use Fireclam but this addon freezes the browser for a few seconds each time a download is finished. I have also tried to play with auto

  • no empty thumbnails on the new tab page

    Page is completely white.

  • BBM SDK app - phone support?

    I'm a little confused about the new BBM SDK supported. Bold 9900 with OS 7.0 will support these apps for sure, as BBM 6.0 will be preloaded. But what about phones with OS6.0 and OS5.0? According to my understanding, BBM 6.0 could run on OS5.0 and OS6

  • Authentication with 802. 1 x

    Hello I know that the concept of 802. 1 x, but I'll be here some difficulties with the English language because I live and was born in a non-English speaking English countries. So the question is which component of 802. 1 x authentication: The beggin

  • Grid block problem

    Hi allI have a small problem when I create a grid of block (I don't know the name, thus: tool text button-> right arrow).InDesign me canvassing all very nicely but after I write that in the first cell, that m 'annoys me at the highest point, not incl