Interactive reports on views with outer joins.

We tried to create an interactive report on a view with an outer join. It generated an error indicating that there is not a single column to identify the row. What APEX rule uses to identify the column that should be identify the line? Select statement should the correct column in the table that provides the extra lines to be one that is identified in the view?

This is your link to the unique view of the record.

Delete the link; make your view preserved key (so you can use rowid) or identify a column to uniquely identify these lines for Apex.

This is done in the link column settings in the report attributes.

SW

Tags: Database

Similar Questions

  • BAD RESULTS WITH OUTER JOINS AND TABLES WITH A CHECK CONSTRAINT

    HII All,
    Could any such a me when we encounter this bug? Please help me with a simple example so that I can search for them in my PB.


    Bug:-8447623

    Bug / / Desc: BAD RESULTS WITH OUTER JOINS AND TABLES WITH a CHECK CONSTRAINT


    I ran the outer joins with check queries constraint 11G 11.1.0.7.0 and 10 g 2, but the result is the same. Need to know the scenario where I will face this bug of your experts and people who have already experienced this bug.


    Version: -.
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    Why do you not use the description of the bug test case in Metalink (we obviously can't post it here because it would violate the copyright of Metalink)? Your test case is not a candidate for the elimination of the join, so he did not have the bug.

    Have you really read the description of the bug in Metalink rather than just looking at the title of the bug? The bug itself is quite clear that a query plan that involves the elimination of the join is a necessary condition. The title of bug nothing will never tell the whole story.

    If you try to work through a few tens of thousands of bugs in 11.1.0.7, of which many are not published, trying to determine whether your application would be affected by the bug? Wouldn't be order of magnitude easier to upgrade the application to 11.1.0.7 in a test environment and test the application to see what, if anything, breaks? Understand that the vast majority of the problems that people experience during an upgrade are not the result of bugs - they are the result of changes in behaviour documented as changes in query plans. And among those who encounter bugs, a relatively large fraction of the new variety. Even if you have completed the Herculean task of verifying each bug on your code base, which would not significantly easier upgrade. In addition, at the time wherever you actually performed this analysis, Oracle reportedly released 3 or 4 new versions.

    And at this stage would be unwise to consider an upgrade to 11.2?

    Justin

  • How to manage the update/insert in display with Outer Join object?

    Hello

    I have a problem in the treatment of update/insert in the original Version that contains two EOs with right outer join. The first EO values are inserted before and I want if second values EO already exists, it will update and if not a new record created.

    Error when I commit after entering values is: ' entity line with null key is not found in SecondEO. "

    What is the solution?

    Thank you

    Hello

    Make sure that your view object, you have included the key attributes of the two entity objects.

    Kind regards

    Saif Khan.

  • Doubt with OUTER JOIN behavior

    I thought I knew all about OUTER JOINS to this scenario. Can pls someone explain how Oracle behaves in the following SQL code:

    WITH t1 AS
    (SELECT 1 as empid from dual
    union all
    select 2 from dual),
    t2 as
    (select 1 as empid from dual)
    select *
    from t1 
    left outer join
    t2
    on (
    t1.empid = t2.empid AND t1.empid=2
    );
    

    Expected O/P

    EMPID EMPID_1
    2NULL VALUE

    Real O/P

    EMPID EMPID_1
    1NULL VALUE
    2NULL VALUE

    In this way...

    SQL > ed
    A written file afiedt.buf

    1 t1 WITH (SELECT empid from all double union 1
    2. Select 2 double),
    3 t2 (select 1 as double empid)
    4  --
    5 Select
    6 T1
    7 * a left outer join t2 (t1.empid = t2.empid) and t1.empid = 2
    SQL > /.

    EMPID EMPID
    ---------- ----------
    2
    1

    the "t1.empid = 2' is part of the OUTER JOIN condition.

    In this way...

    SQL > ed
    A written file afiedt.buf

    1 t1 WITH (SELECT empid from all double union 1
    2. Select 2 double),
    3 t2 (select 1 as double empid)
    4  --
    5 Select
    6 T1
    left outer join 7 t2 on (t1.empid = t2.empid)
    8 * where t1.empid = 2
    SQL > /.

    EMPID EMPID
    ---------- ----------
    2

    the "t1.empid = 2" belongs to the filtering conditions

    When it is part of the OUTER JOIN condition, he says that he should join t2 records where all conditions are met, otherwise the join should not be made, it does not say it to filter the overall results.

    Maybe this helps clarify...

    SQL > ed
    A written file afiedt.buf

    1 t1 WITH (SELECT empid from all double union 1
    2. Select 2 double),
    3 t2 (select empid Union 1 double all the)
    4. Select 2 of the double)
    5  --
    6 select *.
    7 T1
    8 * a left outer join t2 (t1.empid = t2.empid) and t1.empid = 2
    SQL > /.

    EMPID EMPID
    ---------- ----------
    2          2
    1

    Here we have 1 and 2 records in both tables, but the records in t2 are joined only where the record of t1 has an empid 2, so, although t2 has an empid 1, which is not reached because the join condition is not met.

  • Max() with outer join

    I have a couple of tables XX_PERS and XX_ADDRESS as shown below. I would like to return more recent 'city' for each person on the xx_pers table. If no record matching in xx_address, there should always be the id of the person, name of city as null.

    CREATE TABLE xx_pers

    (Key primary ID number,)

    name varchar2 (100)

    );

    CREATE TABLE xx_address

    (

    addr_id PRIMARY KEY NUMBER,

    pers_id NUMBER,

    City VARCHAR2 (25).

    FOREIGN KEY (pers_id) REFERENCES xx_pers (id)

    );

    insert into xx_pers values (1, 'Messi');

    insert into xx_pers values (2, 'Muller');

    insert into xx_pers values (3, 'Ronaldo');

    insert into xx_address values (100.1, "Argentina");

    insert into xx_address values (102.1, "Madrid");

    insert into xx_address values (101.2, "Germany");

    insert into xx_address values (103.2, "Munich - OF");

    The following query returns the most recent 'city' for person 1 and 2 but do not know how to get the 3rd person.

    SELECT ID, name, city

    of xx_pers xx

    , xx_address y

    Where xx.id = y.pers_id

    and y.addr_id in (select max (addr_id) of the xx_address by pers_id group);

    Hello

    Here is another way, which is similar to what you have tried initially, but it uses an outer join to a subquery instead of an IN subquery:

    WITH got_max_addr_id AS

    (

    SELECT pers_id

    MAX (addr_id) AS max_addr_id

    OF xx_address

    GROUP BY pers_id

    )

    SELECT p.id

    p.name

    a.city

    OF xx_pers p

    LEFT OUTER JOIN got_max_addr_id ON m.pers_id = p.id m

    A LEFT OUTER JOIN xx_address ON a.pers_id = m.pers_id

    AND a.addr_id = m.max_addr_id

    ORDER BY p.id

    ;

    It is also very similar to the solution in response #2 above.

    Note Although all 4 of these solutions something in common that is different from the query you posted: they use all of the outer joins.  You obviousy has estimated that an outer join outer join would be useful here, because you mentioned an outer join in the title of the thread, but you are not one yourself.

  • need help with outer join filter.

    Need a little help to filter a result set and I can't seem to find a good way to do this.
    /*table*/
    
    create table invoice( farinvc_invh_code varchar2(100),
                                  farinvc_item varchar2(100),
                                  farinvc_po varchar2(100)
                                  )
       create table po( 
            supplier_number varchar2(60),
            supplier_invoice_no varchar2(60),
            po_number varchar2(60),
            run_date varchar2(60),
            PO_LINE_NUMBER varchar2(60) );
    /*data*/
    
    INSERT INTO "INVOICE" (FARINVC_INVH_CODE, FARINVC_ITEM, FARINVC_PO_ITEM) VALUES ('I0554164', '1', 'P0142245');
    INSERT INTO "INVOICE" (FARINVC_INVH_CODE, FARINVC_ITEM, FARINVC_PO_ITEM) VALUES ('I0554164', '3', 'P0142245');
    INSERT INTO "INVOICE" (FARINVC_INVH_CODE, FARINVC_ITEM, FARINVC_PO) VALUES ('I0554165', '1', 'P0142246');
    INSERT INTO "INVOICE" (FARINVC_INVH_CODE, FARINVC_ITEM, FARINVC_PO) VALUES ('I0554165', '2', 'P0142246');
    
    
    
    
    
    INSERT INTO "PO" (SUPPLIER_NUMBER, SUPPLIER_INVOICE_NO, PO_NUMBER, RUN_DATE, PO_LINE_NUMBER) VALUES ('914100121', '529132260', 'P0142245', '21-NOV-12', '1');
    INSERT INTO "PO" (SUPPLIER_NUMBER, SUPPLIER_INVOICE_NO, PO_NUMBER, RUN_DATE, PO_LINE_NUMBER) VALUES ('914100121', '529137831', 'P0142245', '21-NOV-12', '3');
    INSERT INTO "PO" (SUPPLIER_NUMBER, SUPPLIER_INVOICE_NO, PO_NUMBER, RUN_DATE, PO_LINE_NUMBER) VALUES ('914100121', '529137831', 'P0142245', '21-NOV-12', '2');
    INSERT INTO "PO" (SUPPLIER_NUMBER, SUPPLIER_INVOICE_NO, PO_NUMBER, RUN_DATE, PO_LINE_NUMBER) VALUES ('914100122', '145678', 'P0142246', '22-NOV-12', '1');
    INSERT INTO "PO" (SUPPLIER_NUMBER, SUPPLIER_INVOICE_NO, PO_NUMBER, RUN_DATE, PO_LINE_NUMBER) VALUES ('914100122', '145679', 'P0142246', '22-NOV-12', '2');
    query execution of im.

    SELECT  farinvc_invh_code,
                    supplier_number,
                    supplier_invoice_no,
                    farinvc_item, 
                    farinvc_po ,
                    po_number,
                    run_date,
                    PO_LINE_NUMBER
            FROM INVOICE, PO
            WHERE PO_NUMBER = FARINVC_PO(+)
            AND FARINVC_ITEM(+) = PO_LINE_NUMBER
            
    result
    "FARINVC_INVH_CODE"           "SUPPLIER_NUMBER"             "SUPPLIER_INVOICE_NO"         "FARINVC_ITEM"                "FARINVC_PO"                  "PO_NUMBER"                   "RUN_DATE"                    "PO_LINE_NUMBER"              
    "I0554165"                    "914100122"                   "145678"                      "1"                           "P0142246"                    "P0142246"                    "22-NOV-12"                   "1"                           
    "I0554165"                    "914100122"                   "145679"                      "2"                           "P0142246"                    "P0142246"                    "22-NOV-12"                   "2"                           
    "I0554164"                    "914100121"                   "529132260"                   "1"                           "P0142245"                    "P0142245"                    "21-NOV-12"                   "1"                           
    "I0554164"                    "914100121"                   "529137831"                   "3"                           "P0142245"                    "P0142245"                    "21-NOV-12"                   "3"                           
    ""                            "914100121"                   "529137831"                   ""                            ""                            "P0142245"                    "21-NOV-12"                   "2"                           
    It is a much larger table, and I took an excerpt in order to keep things clear and understanding. I would like to filter the result set to only show lines that have po numbers are the same and line are the same but there is an additional element. in other words as such.
    "FARINVC_INVH_CODE"           "SUPPLIER_NUMBER"             "SUPPLIER_INVOICE_NO"         "FARINVC_ITEM"                "FARINVC_PO"                  "PO_NUMBER"                   "RUN_DATE"                    "PO_LINE_NUMBER"              
    "I0554164"                    "914100121"                   "529132260"                   "1"                           "P0142245"                    "P0142245"                    "21-NOV-12"                   "1"                           
    "I0554164"                    "914100121"                   "529137831"                   "3"                           "P0142245"                    "P0142245"                    "21-NOV-12"                   "3"                           
    ""                            "914100121"                   "529137831"                   ""                            ""                            "P0142245"                    "21-NOV-12"                   "2"                           

    Hello

    Let me assure you that I understand.
    Last time, we were looking for the PO_NUMBERs who have been partially put into correspondence , i.e. groups of rows in the order table with the same po_number, which some had corresponding lines in the table Bill, and some of whom have not. It was essential that there is at least 1 line and 1 row without connections with the same purchase order.
    Now that you are interested SUPPLIER_INVOICE_NOs who are partially paired, i.e. groups of rows in the table of po with the same po_number and supplier_invoice_no, some of which have corresponding lines in the invoice table, and some are not. ("Supplier_Invoice_No" is quite a mouthful. "We'll abbreviate as sin in the future.) However, the final selection is based on po_numbers: If a po_number has partially matched sins, then we are interested all po_number. For example, the result set must include = 529132260 SIN, even if that sin is completely, because there is a partially matching sin (529137831) with the same po_number (P0142245).

    As this problem revolves around partially matching sins, let's call them Cardinal sins . We can calculate match_cnt and total_cnt based NAS as well as po_number. Then, we can use another analytic function so see if the po_number has all cardinal_sins, like this:

    WITH    joined_data     AS
    (
         SELECT     i.farinvc_invh_code
         ,     p.supplier_number
         ,     p.supplier_invoice_no
         ,     i.farinvc_item
         ,     i.farinvc_po
         ,     p.po_number
         ,     p.run_date
         ,     p.po_line_number
         ,     COUNT (i.farinvc_po) OVER ( PARTITION BY  p.po_number
                                            ,                  p.supplier_invoice_no
                               )     AS match_cnt
         ,     COUNT (*)           OVER ( PARTITION BY  p.po_number
                                            ,                  p.supplier_invoice_no
                                          )     AS total_cnt
         FROM           po       p
         LEFT OUTER JOIN  invoice  i  ON   i.farinvc_po    = p.po_number
                                      AND  i.farinvc_item  = p.po_line_number
    )
    ,     got_cardinal_sin_cnt     AS
    (
         SELECT  joined_data.*
         ,     SUM ( CASE
                        WHEN  match_cnt  >= 1
                     AND     match_cnt  <  total_cnt
                     THEN  1
                    END
                  ) OVER (PARTITION BY  po_number)     AS cardinal_sin_cnt
         FROM    joined_data
    )
    SELECT    farinvc_invh_code
    ,       supplier_number
    ,       supplier_invoice_no
    ,       farinvc_item
    ,       farinvc_po
    ,       po_number
    ,       run_date
    ,       po_line_number
    FROM       got_cardinal_sin_cnt
    WHERE       cardinal_sin_cnt     > 0
    ORDER BY  po_number
    ,            farinvc_item
    ;
    
  • Apex 4.0 interactive report row view dynamic action "after Refresh.

    Hello

    It seems that interactive report view row do not trigger the event "after refresh.
    I have not tested other events.

    I have taste.
    https://Apex.Oracle.com/pls/OTN/f?p=40323:76

    There is a dynamic action that show the alert by region "after updating' event.

    When you see a row, the alert is not displayed.
    Change record show no alert ether.

    Is it bug or missing feature?

    Kind regards
    Jari

    Hi Jari,

    I consider this a bug/feature missing as well. I filed bug # 10376989.

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Need help with outer joins

    I have the following table structure,

    _ Table - 1
    ---------------------------------
    ID | Information
    ---------------------------------
    1. abcadskasasa
    2. asdasdasdasd
    3. saeqdfdvsfcsc
    ---------------------------------


    _ Table - 2
    ---------------------------------
    ID | NEST
    ---------------------------------
    1. 12
    1. 13
    2. 14
    1. 15
    1. 16
    2. 12
    ---------------------------------



    _ Table - 3
    ---------------------------------
    ID | THIERRY
    ---------------------------------
    1. 12
    2. 14
    1. 15
    ---------------------------------

    Now, I want to choose for each ID in table 1 and the number of MIP in the table 2-number of THIERRY of table 3.

    Desired output:_

    ---------------------------------------------------------------------------------------------------
    ID | COUNT_PID | COUNT_PARID
    ---------------------------------------------------------------------------------------------------
    1. 4. 2
    2. 2. 1
    3. 0 | 0
    ---------------------------------------------------------------------------------------------------

    Could someone please help me with this. I'm doing using outer joins, but as I work mainly at the edge of the end, not able to reach an appropriate solution to that above.

    Thanks in advance,
    Tejas

    You should not outer join... That should do it...

    select ID , (select count(PID) from table2  t2 where t2.id = t1.id) , (select count(PARID) from table3  t3 where t3.id = t1.id)
    from table1
    
  • Problem with Outer join and filter

    Hello

    I join two tables in the source using a left outer join. Outside of the join, I have a filter specified with condition TabA.C1 > TabB.C2.

    Now, when ODI generates the query it puts the left outer join on the filter condition as well. So he puts filter as

    where
    (1 = 1)
    And ((TabA.C1 = TabB.C1 (+)) AND)
    (TabA.C2 = TabB.C2 (+))
    And TabA.C10 > TabB.C14 (+)

    How to avoid this problem. I tried this performance on stage as well, always generated query remains the same.

    I use the incremental update of the IKM Oracle. My source and target are both on the same PB.


    ~ Chikk

    Hi Chikk,

    If you analyze the data, you'll see it's OK to have the "(+)" to the filter...

    Anyway, if you want to drop it, leave it as inner join and put the "(+)" manually to the join object.

    This help you?

  • Update with Outer Join, round 2

    Thanks for those of you who have helped me out on the first (I never thought that you could use a SELECTION of a line like that).

    However, here is a new version of my problem:

    I have three tables.
    Table_1 has a column that must be updated based on the Table_2 and Table_3 values.
    Table_1 both Table_2 have values used to determine which line of Table_3 to use.
    However, not all the rows in Table_1 has a corresponding line of Table_3, in which case the value of Table_3 to use is assumed to be 1.

    The tables and the corresponding columns are:

    TABLE_1
    value_1 - value update
    key_2 - a pointer to TABLE_2
    key_3a - a pointer to a TABLE_3 or a dummy value if there is no record of the TABLE_3

    TABLE_2
    key_2 - the primary key
    key_3b - a secondary pointer to TABLE_3
    Value_2 - a value to use in the calculation of TABLE_1.value_1

    TABLE_3
    key_3a - the first part of the unique key
    ley_3b - the second part of the unique key
    value_3 - a value to use in the calculation of TABLE_1.value_1

    If there is a line in table_3 which matches the values table_1.key_3a and table_2.key_3b (where table_2.key_2 = table_1.key_2):
    Set table_1.value_1 = table_2.value_2 * table_3.value_3
    If there is no such line in table_3:
    Set table_1.value_1 = table_2.value_2

    I want to do something like this:

    UPDATE table_1 t1
    SET = Value_1
    (
    SELECT T2.value_2 * NVL (t3.value_3, 1)
    IN table_2 t2
    LEFT JOIN t3 table_3
    WE (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    WHERE t2.key_2 = t1.key_2
    )

    However, Oracle does not t1 to be referenced in the outer join clause.
    (Assume that each value of key_2 in table_1 is table_2 as well: it is only the key_3 value that can be a model.)

    If I move "t3.key_3 = t1.key_3" to the WHERE clause, so t1.value_1 is null for lines without the corresponding value of the table_3.

    I can do it with a clone of table_1 using ROWID:

    UPDATE table_1 t1
    SET = Value_1
    (
    SELECT T2.value_2 * NVL (t3.value_3, 1)
    FROM table_1 t1a
    JOIN the t2 table_2
    ON t2.key_2 = t1a.key_2
    LEFT JOIN t3 table_3
    WE (t3.key_3b = t2.key_3b and t3.key_3a = t1a.key_3a)
    WHERE t1a.row_id = t1.row_id
    )

    However, is there an easier way to do it using ANSI joins (i.e. without (+) syntax)?
    I have this feeling I'm missing something obvious here.

    Sorry, I'm not sure understand your scenario this time. It is early and I did have my 64 ounces of caffiene still.

    I didn't look at the statement, you were trying to run and reformatting:

    SQL> UPDATE table_1 t1
      2  SET    value_1 = (SELECT t2.value_2 * NVL((select t3.value_3
      3                                             from   table_3 t3
      4                                             where  t3.key_3b = t2.key_3b
      5                                             and    t3.key_3a = t1.key_3a)
      6                                          ,1)
      7                    FROM   table_2 t2
      8                    WHERE  t2.key_2 = t1.key_2
      9                   )
     10  ;
    
    0 rows updated.
    

    I don't know if it will work for you, but at least it is syntactically correct.

  • Update with Outer Join

    Is it possible to do an update that involves an outer join on the updated table?

    Here's what I mean - now, I have something like:

    UPDATE table_1 t1
    SET col_1 =
    (
    SELECT t2.col_2
    IN table_2 t2
    WHERE t2.t1_key = t1.t1_key
    )
    WHERE THERE ARE
    (
    SELECT t2.*
    IN table_2 t2
    WHERE t2.t1_key = t1.t1_key
    );
    --
    UPDATE table_1 t1
    SET col_1 = 0
    WHERE THERE IS NO
    (
    SELECT t2.*
    IN table_2 t2
    WHERE t2.t1_key = t1.t1_key
    );

    Yes, I could set all values of table_1.col_1 = 0 first and then perform the update first, but it is inefficient because of the number of records in the table that could be updated twice.

    Is it possible to combine these two updates in a single update statement?

    You can simply use your first update and omit the WHERE EXISTS clause since you want to update all rows in table_1 anyway.

    If the subquery finds a match, it will update the selected value. Normally, a non-match would set the column to a null value, but you can solve this with NVL:

    SQL> select * from table_1;
    
                  T1_KEY                COL_1
    -------------------- --------------------
                       1                    1
                       2                    1
                       3                    1
                       4                    1
                       5                    1
                       6                    1
                       7                    1
                       8                    1
                       9                    1
    
    9 rows selected.
    
    SQL> select * from table_2;
    
                  T2_KEY                COL_2
    -------------------- --------------------
                       1                    9
                       3                    9
                       5                    9
    
    SQL> UPDATE table_1 t1
      2  SET    col_1 = nvl (
      3                       (SELECT t2.col_2
      4                        FROM   table_2 t2
      5                        WHERE  t2.t2_key = t1.t1_key
      6                       ),0
      7                     )
      8  ;
    
    9 rows updated.
    
    SQL> select * from table_1;
    
                  T1_KEY                COL_1
    -------------------- --------------------
                       1                    9
                       2                    0
                       3                    9
                       4                    0
                       5                    9
                       6                    0
                       7                    0
                       8                    0
                       9                    0
    
    9 rows selected.
    
  • Need help with outer join

    Hello

    I have a requirement in which I need to get data from a third table where a date of the third table is higher than a date in the second array.

    Ex:

    SELECT t1.column1, t3.column2
    FROM t1, t2, t3
    WHERE t1.id = t2.foreign_id
    AND t1.id ( + ) = t3.foreign_id
    AND t3.some_date_column > t2.another_date_column
    
    

    However, using the query above returns no results if the date condition is not met. I still need to show t1.column1 and a null t3.column2.

    How should I do this?

    Thank you

    Allen

    Edit: Added information about the requirement.

    Hi Allen

    1. SELECT t1.column1, t3.column2
    2. T1, t2, t3
    3. WHERE t1.id = t2.foreign_id
    4. AND t1.id = t3.foreign_id (+)
    5. AND t3.some_date_column (+) > t2.another_date_column

    I guess that this t1.column1 must not be null. Or am I wrong? The + sign must be placed on the side where draws are accepted. You must repeat it for each condition on the table.

    Alternativlely you can use the LEFT OUT JOIN syntax. If the two columns are allowed null you need a FULL OUTER JOIN.

    BTW: The join to t2 is not required if a refefernce constraint forced.

  • How to replace the interactive report '-' for null with white columns fields?

    The reports interactive one places '-' for null column fields. In the classic report, column null fields remain just as a draft. Y at - it a setting to change how many interactive reports display columns null fields? I would prefer that it be display as the classic report and leave the fields to null as a draft column.

    THX

    Published by: jngoracle on July 24, 2010 22:43

    Hello

    Will modify your report interactive report attributes.
    In the paging section, you can change attribute "see the Null Values as".

    BR, Jari

  • restrict records with outer join

    Hello

    With the help of Oracle 11 g R2.

    I have 2 tables and I want outside to join them. However, when a record is found on the 2nd table, I only need the folder with the largest value in column 2. Here are some data.

    create table a (col1, col2 number)
    insert into a values (1, 10)
    insert into a values (1, 20)
    insert into a values (1, 30)
    insert into a values (1, 30)
    insert into a values (2: 20)
    insert into a values (3, 10)
    insert into a values (3: 20)
    insert into a values (3, 30)

    create table b (col1, col2 number number)
    insert into values of b (1, 1)
    insert into values of b (1, 2)
    insert into values of b (2, 1)
    insert into values of b (2, 2)

    This shows all the records, but when a record is found in table b, I need the folder with the largest value for column 2.

    select a.col1, 
           a.col2, 
           b.col1, 
           b.col2
    from   a, b
    where  a.col1 = b.col1 (+)
    and    a.col2 = 20
    order by 1, 2
    

    I tried this, but too many files got removed the result.

    
    select a.col1, 
           a.col2, 
           b.col1, 
           b.col2
    from   a, b
    where  a.col1 = b.col1 (+)
    and    a.col2 = 20
    and    b.col2 = (select max(b2.col2) from b b2
                     where  b2.col1 = b.col1)
    order by 1, 2
    

    Hello

    The General method to do this is to treat it as a Query of Top - N, where you choose N (N = 1 in this case) lines from the top of an ordered list:

    WITH got_r_num AS

    (

    Select a.col1,

    a.col2,

    b.Col1 AS b_col1,

    b.col2 AS b_col2

    ROW_NUMBER () OVER (PARTITION BY a.col1

    ORDER BY b.col2 DESC

    ) AS r_num

    of a, b

    where a.col1 = b.col1

    and a.col2 = 20

    )

    SELECT col1, col2, b_col1, b_col2

    OF got_r_num

    WHERE r_num = 1

    ORDER BY col1, col2

    ;

    In this case, you could also do a GROUP BY:

    Select a.col1,

    a.col2,

    b.Col1,

    MAX (b.col2) AS b_col2

    of a, b

    where a.col1 = b.col1

    and a.col2 = 20

    GROUP OF a.col1, a.col2, b.col1

    order by 1, 2

    ;

  • Interactive report in popup with the value of research and submit

    Hello

    I want to start a pop up with an IR in there that gets a value in the search box, and finally a submit/search actiion should refresh the report.
    onload = "set_ir_search_val (); "
    & lt; script language ="JavaScript"type =" text/javascript">
    function set_ir_search_val() {}
    var v_stop_js = document.getElementById ('P105_STOP_JS');
    If (v_stop_js.value! = 1) {}
    var v_page = 'P' + '& P105_WHEREFROM.' + "_ID";
    var v_from = opener.document.getElementById (v_page);
    var v_to = document.getElementById ('apexir_SEARCH');
    v_to. Value = v_from.value;
    v_stop_js. Value = 1;
    / * gReport.search('SEARCH'); -that didn't work * /.
    }
    }
    & Lt; / script >
    unfortunately the update report does not work automatically. Firebug means: gReport is not defined

    Any ideas?

    Thanks in advance,

    Tobias

    Hello

    I think, to begin with, it should be something like:

    function set_ir_search_val() {
    var v_stop_js = document.getElementById('P105_STOP_JS');
    if (v_stop_js.value != 1) {
    var v_page = 'P' + '&P105_WHEREFROM.' + '_R_TIL_E_ID';
    var v_from = opener.document.getElementById(v_page);
    var v_to = document.getElementById('apexir_SEARCH');
    v_to.value = v_from.value;
    v_stop_js.value = 1;
    gReport.search('SEARCH');
    }
    }
    addLoadEvent(set_ir_search_val);
    

    If all goes well, this should load the function in the onload event after the init_gReport() function. If it does not make it, you can try then do:

    function set_ir_search_val() {
    init_gReport();
    var v_stop_js = document.getElementById('P105_STOP_JS');
    if (v_stop_js.value != 1) {
    var v_page = 'P' + '&P105_WHEREFROM.' + '_R_TIL_E_ID';
    var v_from = opener.document.getElementById(v_page);
    var v_to = document.getElementById('apexir_SEARCH');
    v_to.value = v_from.value;
    v_stop_js.value = 1;
    gReport.search('SEARCH');
    }
    }
    addLoadEvent(set_ir_search_val);
    

    Andy

Maybe you are looking for

  • iPhone 5 stuck in boot loop

    Hey everybody, I recently encountered a problem where I replaced one of my friend 5 iPhone battery and when I plugged it in to charge that he was stuck in a boot loop cycle. The Apple logo appear and disappear over and over again and never start.  I

  • Download ringtones that I am sent to me by iCloud from a friend on my ITunes on my computer?

    MY aunt sent me some ringtones for my iphone 6 and I want to upload them to my ITunes on my computer. Is it possible and if yes, how can I do this?

  • Satellite L630: unsupported message bios while the installation of ECO urinary infections

    Hello everyone, can someone help me solve this problem?I have the Satellite L630. After the installation of the new operating system and drivers during the installation of the Eco utility, it gives me this 'unsupported bios. What can I do?Note: I hav

  • Hello, I have a problem.

    Hello, I have a problem. More on the keyboard keys to work with by pressing the "fn" and later Assistant HP Suppurt proposed upgrade, I agree, update are taken into account, and all additional keys work now without a "fn" key is not practical. Tried

  • Laptop does not connect to internet

    Sometimes my laptop works for days without problem, then other days I turn it on and it was just a red cross on the internet icon, and it shows there is no other network at all and then finally 10 to 15 minutes later he could decide to connect, other