Get the same results without line of sight

Hi gurus,

My version of the database is 10.2.0.4.0.

I have a couple of tables as follows:

CREATE TABLE xxgroups(group_number NUMBER, description VARCHAR2(30));

INSERT INTO xxgroups VALUES(1,'Group 1'); 
INSERT INTO xxgroups VALUES(2,'Group 2');
INSERT INTO xxgroups VALUES(3,'Group 3');
INSERT INTO xxgroups VALUES(4,'Group 4');
INSERT INTO xxgroups VALUES(5,'Group 5');

CREATE TABLE xxgroup_persons(group_number NUMBER, person_number NUMBER, first_name VARCHAR2(30), last_name VARCHAR2(30));

INSERT INTO xxgroup_persons VALUES(1, 1, 'John', 'Smith');
INSERT INTO xxgroup_persons VALUES(1, 2, 'James', 'Smith');
INSERT INTO xxgroup_persons VALUES(1, 3, 'Joe', 'William');
INSERT INTO xxgroup_persons VALUES(2, 4, 'Julien', 'Ford');
INSERT INTO xxgroup_persons VALUES(2, 5, 'James', 'Kelly');
INSERT INTO xxgroup_persons VALUES(3, 6, 'Francis', 'Smith');
INSERT INTO xxgroup_persons VALUES(5, 7, 'Jerry', 'Ford');
INSERT INTO xxgroup_persons VALUES(5, 8, 'Alfred', 'Willis');
INSERT INTO xxgroup_persons VALUES(5, 9, 'Jon', 'Preston');

COMMIT;
I would like to get a query to return for each group, the person with less person_number (if no one assigned to the group, then the query must return again with an empty person group). I know I can do this by using for example:
SELECT group_number, person_number, first_name, last_name 
FROM (SELECT a.group_number, b.person_number, b.first_name, b.last_name
           , RANK() OVER (PARTITION BY a.group_number ORDER BY person_number) person_order
      FROM xxgroups a, xxgroup_persons b
      WHERE a.group_number = b.group_number (+)
     ) 
WHERE person_order = 1
ORDER BY group_number;

GROUP_NUMBER PERSON_NUMBER FIRST_NAME                     LAST_NAME
------------ ------------- ------------------------------ ------------------------------
           1             1 John                           Smith
           2             4 Julien                         Ford
           3             6 Francis                        Smith
           4
           5             7 Jerry                          Ford
but it would be possible to achieve the same results without inline mode?

Thank you.

You can try this function KEEP:

scott@orapdt>  SELECT a.group_number,
  2         min(b.person_number) as person_number,
  3         min(b.first_name) keep (dense_rank first order by person_number) as first_name,
  4         min(b.last_name) keep (dense_rank first order by person_number) as last_name
  5  FROM xxgroups a, xxgroup_persons b
  6  WHERE a.group_number = b.group_number (+)
  7  group by a.group_number;

GROUP_NUMBER PERSON_NUMBER FIRST_NAME                     LAST_NAME
------------ ------------- ------------------------------ ------------------------------
           1             1 John                           Smith
           2             4 Julien                         Ford
           3             6 Francis                        Smith
           4
           5             7 Jerry                          Ford

5 rows selected.

Tags: Database

Similar Questions

  • printer Lexmark Pro 200. Does not print the correct colors. I restarted my computer and the printer is off but get the same result.

    Printer Lexmark Pro 200.  Does not print the correct colors. I restarted my computer and the printer is off but get the same result.

    Hello

    • What were the changes made before the problem occurred?

    You try to run this fix and check.

    http://Windows.Microsoft.com/en-us/Windows7/open-the-printer-Troubleshooter

    If above does not work, try contacting Lexmark support for assistance.

    http://www1.Lexmark.com/en_US/global-services/customer-support-services/index.shtml

  • I can't get Adobe Flash Player to date on my Mac. It keeps telling me to close Safari, even if it is closed. I tried all the suggestions on the Adobe site and always get the same results. Thanks for any help

    I can't get Adobe Flash Player to date on my Mac. It keeps telling me to close Safari, even if it is closed. I have tried every thing on the Adobe site to solve the problem with the same results still. I went to the site of both Mac and said to go to Adobe for a solution. It worked fine as a new Mac in February, but it will not update now, so no Flash Player ay all. Thanks for any help.

    By clicking the red dot on the safari window it minimizes, but leave the program running.

    To exit Safari completely, open Safari by clicking on the dock icon, and then choose Safari > Quit Safari to the upper left of the screen.

  • How can I get the same results from Google Images like in internet Explorer

    If I search Google Images in IE8, I get a list of result pages with a fixed number of items per page. These thumbnail images download quickly, and under each image there is useful information about the content of the image and its source. Images on the next page doesn't download not unless if I select the next page in the list, so that the modem activity stops quickly.

    When I use the same URL - www.google.com - in Firefox and go to Images, I get pages with an indefinitely large number of images of result. All images are stuck next to each other, and there is no other useful information from the text shown at all. If I try to scroll to the bottom of the screen, images more keep downloading. There seems to be no Google settings available in this view to limit the number of images per page.

    Only problems with this is that I am currently limited to 56 KB connection. Images from this point of view download so slowly that they simply never complete in a reasonable time.

    However, apart from the speed of connection, there is the question of the useful information from the missing text.

    I can search for photos on startpage.com and get something like the old format of Google, but I can't receive the best list of results that I expect from Google. StartPage uses Google for their research on the web regularly, according to a note on the web search display. But if I go to Images, this note disappears.

    I call it the traditional Google Images Search in Firefox?

    Problem solved by saving a bookmark to Google and then to add by changing the & sout = 1 keyword in the URL.

    When Google is accessible with this keyword, it will ship between web and image searches.

    This example gets always the classic view of Google images.

  • How to get the same result on different characterset?

    Hello experts,

    I use

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE 11.2.0.3.0 Production"
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    

    Needing a result even on my example.

    SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET WE8MSWIN1252
    FROM DUAL;
    --result 136
    
    

    SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET AL32UTF8
    FROM DUAL;
    --result 52102 but need 136
    
    

    I need same result.

    Thanks for your time...

    EDITED RESULT.

    Ask2Learn

    You test something that you call "encrypted" data, which are not at all encryption.

    For example speaking of letter t.

    The CHR (ASCII('t') + 20) operation is pretty useless. You try to find the character that has the code binary and longer than 20 that the letter 't'. This can work with single-byte as WE8MSWIN1252 character sets, but it does not work with variable width as AL32UTF8 character sets. The letter 't' a code 0 x 74 in WE8MSWIN1252 and AL32UTF8. If you add 20 (decimal), you get 0 x 88. Byte 0 x 88 is a valid code in the WE8MSWIN1252, but is not a valid code in AL32UTF8. Bytes in this range may bytes of continuation in AL32UTF8, i.e. a second, third or the fourth byte of a multi-byte sequence.

    The "circumflex accent" character code 0 x 88 (in WE8MSWIN1252) has the code of two bytes 0xCB 0 x 86 in AL32UTF8.

    So, why not take a look at DBMS_CRYPTO integrated


    Hope this helps


    Hamid

  • Can you explain to me why I do not get the same result (vSphere Client Web vs API)

    Hello

    When I create a new switch logic of vSphereWebClient/network & Security/LogicalSwitches

    I don't see a RESTClient 'GET nsx_url/api/2.0/vdn/virtualwires» '.

    Why?

    Thank you

    Logical switch how do you have in your environment. This particular API call you are using has a paging feature and by default returns only the first 20 objects.

    The NSX 6.2 API Guide

    where? PageSize = XX & YY = startindex specifies the results of the query to the major pages. The default pagesize is 20 and default startindex is 0.
  • sometimes Firefox does not correctly load a few days and I don't see some items. I tried uninstalling and reinstalling, but I get the same result

    Sometimes certain pages of Firefox do not load correctly, there are very few pictures and text on the page is not material to the normal website.
    I can still maneuver around, but it is extremely difficult

    Hello

    Please try pressing Ctrl + F5 on the keyboard when a problematic site.

  • How do I get the same results in the Union vs join statement statement

    Hello

    I have 3 related tables and you must combine customers table1 and table3. My Control Panel is constantly evolving based schedule changes or order_completed qty. I have two problems that I can't solve.

    Table 1: Manager has fields {managerId, Mangager_name, customerId & customer}
    Table2: client includes the fields {customerId, orderId, product manager, managerId and}
    Table 3: order has fields {orderId, customerId, customer, date, amount_order, qty, order_completed}

    1. I need check what are customers or away from table Manager / order based on customerId and managerId

    Here is the example of union that I would like to convert a join because I need to include aggregated order table fields and the customer at table eating based on the field of the client:

    Select m.client
    Manager m
    where m.managerId = 22
    Union select m.client in order o where o.customerId = 65

    2. create a view or a temporary table (called State) to the report with an additional field that determines if the client has been found in the roll of the order and not in the table Manager.

    Example of a view of the State or the temporary table select output
    rownum. customer | status
    1. Mary | The two Tables
    2. Tomas | The two Tables
    3. John | Customer table
    4. April | Customer table

    Thanks for the help

    Hello

    SQL> create table manager (m_id number, m_name char(10), customer_id number, client char(10));
    
    Table created.
    
    SQL>
    SQL> insert into manager values (10,'M_1',111,'AAA');
    
    1 row created.
    
    SQL> insert into manager values (20,'M_2',222,'BBB');
    
    1 row created.
    
    SQL>
    SQL> create table customer (C_id number, m_id number, order_id number);
    
    Table created.
    
    SQL>
    SQL> insert into customer values (111,10,5000);
    
    1 row created.
    
    SQL> insert into customer values (222,20,5001);
    
    1 row created.
    
    SQL> insert into customer values (333,NULL,5002);
    
    1 row created.
    
    SQL> create table order_dt (Order_id number, c_id number, Client char(10));
    
    Table created.
    
    SQL> insert into order_dt values (5000,111,'AAA');
    
    1 row created.
    
    SQL> insert into order_dt  values (5002,333,'CCC');
    
    1 row created.
    
    SQL> select  rownum, a.c2, CASE WHEN ((a.ct2+a.ct1) = 2) THEN 'Both Tables'
      2         WHEN (a.ct2 = 1) THEN 'Client table'
      3         WHEN (a.ct1 = 1) THEN 'Manager table'
      4         ELSE 'NULL'
      5    END AS status
      6  from (
      7  select NVL(m.Client,o.Client) c2,count(m.Client) Ct1, count(O.Client) ct2
      8  from   manager m,
      9  customer c,
     10  order_dt O
     11  where m.m_id(+) = c.m_id
     12    and c.c_id = O.c_id(+)
     13  group by m.Client,O.Client
     14  ) A
     15  ;
    
        ROWNUM C2         STATUS
    ---------- ---------- -------------
             1 AAA        Both Tables
             2 CCC        Client table
             3 BBB        Manager table
    

    -Pavan Kumar N

  • Can do us a query to get the same results of 3 tables

    CREATE TABLE TABLE1 (NODEID VARCHAR2 (4));
    CREATE TABLE TABLE2 (NODEID VARCHAR2 (4));
    CREATE TABLE TABLE3 (NODEID VARCHAR2 (4));


    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1005');
    INSERT INTO TABLE1 VALUE('1005');

    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');

    INSERT INTO TABLE 3 VALUE('1001');
    INSERT INTO TABLE 3 VALUE('1001');
    INSERT INTO TABLE 3 VALUE('1006');
    INSERT INTO TABLE 3 VALUE('1006');
    INSERT INTO TABLE 3 VALUE('1005');
    INSERT INTO TABLE 3 VALUE('1005');
    INSERT INTO TABLE 3 VALUE('1004');
    INSERT INTO TABLE 3 VALUE('1004');
    INSERT INTO TABLE 3 VALUE('1004');
    INSERT INTO TABLE 3 VALUE('1002');
    INSERT INTO TABLE 3 VALUE('1002');
    INSERT INTO TABLE 3 VALUE('1002');
    INSERT INTO TABLE 3 VALUE('1002');

    SELECT count (*), count (distinct nodeid)
    of table1, table2, table3
    where table1.nodeid = table2.nodeid and table1.nodeid = table3.nodeid;


    SELECT count (*), count (distinct nodeid)
    FROM table1, table3
    where table1.nodeid = table2.nodeid;

    SELECT count (*), count (distinct nodeid)
    from table2, table3
    where table2.nodeid = table3.nodeid;
    SQL> SELECT MAX (CASE WHEN row_ind = 1 THEN ct END) ct_1,
      2         MAX (CASE WHEN row_ind = 1 THEN distinct_ct END) distinct_ct_1,
      3         MAX (CASE WHEN row_ind = 2 THEN ct END) ct_2,
      4         MAX (CASE WHEN row_ind = 2 THEN distinct_ct END) distinct_ct_2,
      5         MAX (CASE WHEN row_ind = 3 THEN ct END) ct_3,
      6         MAX (CASE WHEN row_ind = 3 THEN distinct_ct END) distinct_ct_3
      7    FROM (SELECT 1 AS row_ind,
      8                 COUNT (*) ct,
      9                 COUNT (DISTINCT table1.nodeid) distinct_ct
     10            FROM table1, table2, table3
     11           WHERE table1.nodeid = table2.nodeid
     12                 AND table1.nodeid = table3.nodeid
     13          UNION ALL
     14          SELECT 2 AS row_ind, COUNT (*), COUNT (DISTINCT table1.nodeid)
     15            FROM table1, table3
     16           WHERE table1.nodeid = table3.nodeid
     17          UNION ALL
     18          SELECT 3 AS row_ind, COUNT (*), COUNT (DISTINCT table2.nodeid)
     19            FROM table2, table3
     20           WHERE table2.nodeid = table3.nodeid)
     21  /
    
          CT_1 DISTINCT_CT_1       CT_2 DISTINCT_CT_2       CT_3 DISTINCT_CT_3
    ---------- ------------- ---------- ------------- ---------- -------------
            50             2         26             5         25             2
    

    There may be an easier way...

  • Disc and DVD player read not only draw message get open no disc in the drive, again with the same results.

    Sought to follwed and previous forum information steps to unload the upper and lower registry filters but none are included.

    Have you tried devcon in back and get the followin message "devcon is not recognized as a builtin or external operable program or batch file."
    'Fix It' have tried without success
    Bought new dvd but still get the same results.

    Hello lyneham5155,

    Thank you for using the Microsoft answers Forum

    When this disk is listed in your device manager and you view the properties give any particular error as code 39 or code 10 code? Article below may help determine what the issue might be or helping to solve completely. Sometimes, the stack of filters in the registry is corrupted by software that is using the drive for some actions, such as write applications or multimedia CD or DVD. Take a look at the article below and see if it helps you solve your problem.

    Your CD or DVD drive is missing or is not recognized by Windows or other programs

    http://support.Microsoft.com/kb/314060

    Judd
    Engineer Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • How can I load Vista Service Pack 2? I get the same error messages when I try to download it from the Microsoft support site

    I have a Dell computer with a 32-bit version Vista Ultimate factory loaded. Service Pack 1 is loaded.  I tried to load Vista Service Pack 2 several times by using the following procedure and it does not load.
    -From Microsoft technical support I click Download (using a cable modem) and click on the file to run.   The file MB 475 downloads in about 5 minutes.
    -Click on install Vista Service Pack 2 and it starts to install
    -After about 10 minutes, a message appears "installation was not successful 800F081F error Code.  A system error not install the service pack.  Please download and run the tool to "Check for System Update Readiness". »
    -J' I download system analysis tool and start the installation.
    -Get a message "Installation update for Windows (KB947821) update 1 of 1"
    -After a long time, a message appears saying that the Installation has failed with an error Code 800706BE.

    I repeated this process several times and always get the same result.
    My McAfee security software and spyware blocker is disabled during this process

    The update is not installed successfully, you receive a message, and the computer restarts when you try to install an update in Windows Vista
    http://support.Microsoft.com/kb/949358

    See also the post of 'Response' in this discussion partners: http://social.answers.microsoft.com/Forums/en-US/vistainstall/thread/ad5159b6-edc7-4c45-842a-c8197aec3e07

    ========================

    Free unlimited installation and compatibility support is available for Windows Vista, but only for Service Pack 2 (SP2). This support for Windows Vista Service Pack 2 (SP2) is valid until November 26, 2009. Availability of support chat or messaging differs depending on your location. Go to http://support.microsoft.com/oas/default.aspx?prid=13014&gprid=582034 & select appropriate category (i.e., download problem;) Installation problem; Problems after installing a service pack). ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Lightroom CC will not open. Flash screen flashes, but that is it. Uninstalled and reinstalled (with CC), but got the same result.

    I installed Lightroom CC CC on Macbook Yosemite 10.10.3 running App. It says it is installed, but the attempts to open it get only a snapshot of the screen flash, then nothing. I uninstalled and reinstalled, but get the same result.

    I can assure you that disconnect from creative cloud and reconnect works, like the post above.

    Adobe: Creative cloud must die a horrible death. Bring regular return of your product licenses. CC has been nothing other than a nightmare.

  • I'm trying to download the trial version for Acrobat DC edit PDF files, but when download initializes, it gets to 11%, gets stuck, then gives the message "request from Web Get failed. I canceled, downloaded the installer again and got the same result.  I'

    I'm trying to download the trial version for Acrobat DC edit PDF files, but when download initializes, it gets to 11%, gets stuck, then gives the message "request from Web Get failed. I canceled, downloaded the installer again and got the same result.  I'm on a PC running Windows 8. Any suggestions?

    Hiddm93421458,

    Restart your system and then try again to install Acrobat Reader DC using this link Download Adobe Acrobat free trial | Acrobat Pro DC.

    Let me know if the problem persists.

    Kind regards

    Nicos

  • When I try to copy files to a CD, I get message "Windows has a problem to copy this file to a CD." How to fix? I get the same message that I click on "Copy to CD" or drag the file to copy to the CD player.

    When I try to copy files to a CD, I get the message "Windows has encountered a problem when trying to copy this file."  I press the button "Retry" without any result.  I get the same message that I have click on 'Copy' files on a CD or drag the files to copy to the CD player.  I was able to copy these same files to a CD a few days ago.  Thanks for the suggestions.

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    1. don't you get an error code along with this error message?
    2. what CD burning software is installed on your computer?
    3. what kind of CD do you use to burn?
    4. What is the status of the CD - DVD drive in Device Manager?

    Method 1.
    Let us first check the status of the optical drive in the Device Manager. Check if there is no error code or yellow mark is listed.
    Reference:
    Explanation of error codes generated by Device Manager in Windows XP Professional
    http://support.Microsoft.com/kb/310123

    Method 2.
    If the problem is to start the computer in a clean boot state and check if you are able to accomplish this task.
    Reference:
    How to configure Windows XP to start in a "clean boot" State
    http://support.Microsoft.com/kb/310353/en-us
    Note: When you are finished troubleshooting, follow the steps as explained in the article to reset the computer to start as usual.

    I hope this helps.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I get the same twice fax, Microsoft Fax and Scan team

    Why I get twice the same fax, name of the senders in one says: Microsoft Fax and Scan team, without sender name?

    Hello mikesun,

    ؠ you get the same fax duplicate from the same number?

    Try to configure the fax once more with the default settings. Here is an article that will give you information about configuring fax:

    http://Windows.Microsoft.com/en-us/Windows7/set-up-your-computer-to-send-and-receive-faxes

    Check the fax settings, there will be an option to select the Fax number you receive from the sender.

    Thank you
    Irfan H, Engineer Support Microsoft Answers. Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for

  • Help with account permissions / Yosemite

    Looking for help well informed with a pesky question of Yosemite... I have an old Mac with multiple disks, and I try to get the most recent versions of Mac OS X installed and working properly. The hardware and OS details: Mac Pro 4.1 ("cheese grater"

  • 1150UK HP Pavillion H8: Compatible graphics card

    I'm looking to upgrade my graphics card that is currently NVIDIA Geoforce GT 530. If anyone can recommend that will be compatible with the HP Pavillion H8 1150UK?

  • Cannot modify images in my Image garden

    Hello I wonder if anyone has had this problem: I can view and print the images using my kindergarten picture very well, but when I try to use the feature of special filter or correct/improve, all I see is a question mark in the center of the editing

  • My Canon pixma MG6320 must be connected to my computer does a 'download' a new driver?

    My Canon pixma MG6320 must be connected to my computer does a 'download' a new driver?

  • 32-bit and 64-bit serial keys

    Hi, I have 2 authentic versions of Windows XP Professional 32-bit. However, my computer supports x 64 and he'd win. So, I'm wondering if I can use my current Windows XP Pro 32-bit serial key to activate a Windows XP Professional x 64 edition.