Need to get the latest news for a group-max (value) of the non-null values

Hello

Here is my table and data

SQL > desc method

NUMBER OF SEQ_ID
EMP_ID NUMBER
ISSUE GUID
FIRST NAME VARCHAR2 (30)
LAST_NAME VARCHAR2 (30)
E-MAIL VARCHAR2 (45)
PHONENO VARCHAR2 (30)

SQL > Select * method;

SEQ_ID EMP_ID GUID FIRST_NAME LAST_NAME EMAIL PHONENO
------ - ----- ---- --------- --------------------------------------------------- ----------------------------------------- ------------------------------
1 100 20 RAJA HHH 686678
2 100 20 [email protected]
3 100 20 RAJA 134555
4 100 20 HAPPY [email protected]
5 200 20 RAM
6 200 20 JJJ 2345667
7 200 20 RM GGG [email protected] 1234557
8 200 20 [email protected] RRR

8 selected lines


I want the latest news on the employee, the group id comibnation for the rest of the columns.

So I want to get the following result.

100 20 RAVI HHH [email protected] 134555

200 20 RRR GGG [email protected] 1234557


If you note here for the family name, we take the previous value non-zero value Eg HHH column and is the same for all columns.

It's the value of line max (seqid) for empid, combination of guid and if the column values are null, we must get the previous maximum value non-zero.

The seqid is also there that the sequence.

Please help me to get the result set.

Thanks in advance.

mjhraja.
SQL> select emp_id, guid, max(first_name) first_name, max(last_name) last_name
  2    , max(email) email, max(phoneno) phoneno
  3  from (
  4    select emp_id, guid
  5      , first_value (first_name ignore nulls)
  6          over (partition by emp_id, guid order by seq_id desc) first_name
  7      , first_value (last_name ignore nulls)
  8          over (partition by emp_id, guid order by seq_id desc) last_name
  9      , first_value (email ignore nulls)
 10          over (partition by emp_id, guid order by seq_id desc) email
 11      , first_value (phoneno ignore nulls)
 12          over (partition by emp_id, guid order by seq_id desc) phoneno
 13    from emp_info
 14  )
 15  group by emp_id, guid
 16  /

    EMP_ID GUID FIRST_NAME LAST_NAME  EMAIL                PHONENO
---------- ---- ---------- ---------- -------------------- ----------
       100   20 RAVI       HHH        [email protected]         134555
       200   20 RRR        GGG        [email protected]       1234557

SQL> 

Tags: Database

Similar Questions

  • Need to get the not null fields

    Hello

    I use jdev 11.1.1.5

    I need to get all fields who r have certain values
            ViewObjectImpl vo = this.getAccountClass1();
            for (i=0;i<vo.getRowCount();i++){
                 Row vor = vo.next();
                if (vor.getAttribute("GaclSchNo").equals("NULL")){
                    System.out.println ("null");
                }
                System.out.println ("NotNull");
            }
    In this case the Null value I get an exception like Java.null.

    But I need to print Null.,.

    How can I achieve this

    Try using the code below.

    > ViewObjectImpl vo = this.getAccountClass1 ();
    > for (i = 0; i<>
    > Rank vor = vo.next ();
    > * If (vor.getAttribute ("GaclSchNo") == null) {*}
    > System.out.println ("null");
    > }
    > System.out.println ("not null");
    > }

  • need to get the Service Pack 2 and 3 for XP home

    Recently installed new h-drive. Re-installed XP Home with services Pack 1 a. I need to get the Service Pack 2 and 3, but none of Microsoft download sites will work for me. What should I do to fix this?

    You don't need sp2 (which is a chance, l because the sp2 link no longer works).

    Download sp 3 here: http://www.microsoft.com/en-us/download/details-b.aspx?id=24

    First read this: HOW TO get WinXP SP1 or SP2 fully patched after a 'clean install': http://groups.google.com/group/microsoft.public.windowsxp.general/msg/a066ae41add7dd2b

  • I have several versions of InDesign 6 on different MACs and need to get the serial numbers for them. How can I get them?

    I have several versions of InDesign 6 on different MACs and need to get the serial numbers for them. How can I get them?

    If they were recorded at Adobe.com, sign in under the adobe ID, a number will be there.

    If they were purchased in the box and unregistered, you need to find the number in the box (usually on the sleeve)

  • Im getting a new computer soon and the need to get the link to reinstall my Adobe CS3 (or 4)

    Im getting a new computer soon and the need to get the link to reinstall my Adobe CS3 (or 4)

    Hi Suzanne,.

    Please find the link below:

    CS3: download products CS3

    CS4: download products CS4

    Kind regards

    Sheena

  • I downloaded the extensions Manager. But I only have the 7.0.0.347 version. I need to get the latest version, how do I get it?

    I downloaded the extensions Manager. But I only have the 7.0.0.347 version. I need to get the latest version, how do I get it?

    Please use free CC Desktop App to get the latest version of the extension manager.

  • need to get the installation for vmware Tools packages

    Hello

    With the help of ESX 4. I need to get the installation packages for the vmware tools for each version of Windows Server 2008 R2, Windows Server 2008 (x 86 and x 64) and Windows Server 2003 (x 86 and x 64).

    1. where can I get them?

    2 support without monitoring/silent install? I need to add them to an existing deployment routine.

    Thanks in advance!

    All the tools on your ESX host .iso files can be found in

    /vmimages/tools-isoimages/
    

    There is a way to push tools, but part of the upgrade tools are NETWORK card drivers and you can lose some pings or experience of ping times raised the expectations of the customers.

    An example of a sudden of thumb through AD is http://itknowledgeexchange.techtarget.com/virtualization-pro/how-to-install-vmware-tools-through-windows-group-policy/

  • need to get the part number for fan of cooling of the laptop dv6 of my desire

    s/n [number of Series edited by Moderator]

    p/n C2L44UA #ABL

    less than two years old fan cooling makes rattling noises now, check the dust, cleaned air jet led, the still small makes fan noise rattling sound, need to get the part number and get a very convenient where the fan dies every day.

    Please help. the hp site "to find the part number" does not work, only list other pieces, but no cooling fan.

    DV6 - 7250CA

    nVidia GT630M graphics i-7 mobile quad-processor

    To be used on the computer models equipped with an Intel processor and a graphics subsystem with discrete memory 682061-001

    HP $51

    eBay $37

    eBay uses $28

    Your manual

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • I need to get the factory setting

    Dear brothers,

    I need to learn how can I reset my DESIRE m6 dx1105 to the factory setting that include Win8 with all software and the original drivers.

    I faced a major problem which made me have to format the system and install the new Win8.1

    You know, I lost the hp logo when starting the laptop.

    There are a few problems with some software like software Cyberlink PhotoDirector, who refuses to be installed because my laptop is not allowed machine!

    I need to get the year ago as before factory setting, I bought the laptop!

    Thanks for your help.

    Hello

    According to this page specifications (http://support.hp.com/us-en/document/c03489385 , your laptop came with ' Standard/Core/Basic edition' of Windows 8 64-bit.)

    Only 4 editions exist for Windows 8-

    Standard-Basic-basic
    RT
    Enterprise
    Professional

    Related: http://en.m.wikipedia.org/wiki/Windows_8_editions

    There is no need to buy a new installation of Windows 8 for reinstallation disc
    It will cost you money & also it would contain a different set of product key that should be used in another system, also when you purchase the installation disk of retail sales that it may not work with your system, as it is not an OEM installation media & product key would be retail

    8 Windows laptop product key is encrypted in the BIOS of the laptop chip in the motherboard, would automatically activate the OEM of Windows 8 when installing.

    You can do your own installation of Windows 8 OEM media ordinary from another computer if you have access:

    Link to the 8 x 64 ISO of Windows file, download, save it to a known location on the system.

    https://docs.Google.com/file/d/0B0W9PBigPy94aVJWSndyTFNFMzg/edit?PLI=1

    After you download the file, use this tool to make the file on a flash USB 4 GB or DVD drive bootable.
    The tool works for Windows 8 too-

    http://www.microsoftstore.com/store/msusa/HTML/pbPage.Help_Win7_usbdvd_dwnTool

    Note:
    When you click on the link to the iso file, sometimes you may get this message:

    "Sorry, you can't view or download this file at this time.
    Too many users have seen or this file downloaded recently. Please try to access to the file again later. If the file you are trying to access is particularly important or is shared with many people, it may take up to 24 hours to be able to view or download the file. If you can not access a file after 24 hours, contact your domain administrator. »

    As the message says you can try again later or tomorrow. Must try several times until you get to download it - has a daily download limit.

    After making the bootable install OEM Windows 8 x 64 support, simply start your system when booting from it & installing,

    Note:
    What you will do here is a new Installation & installation media will not contain the programs, software, provided drivers with your laptop when you bought it,

    You could download the drivers from your product download page & save on another Flash/USB drive and run the configuration file after you have installed Windows 8 successfully in your system.
    Drivers download site: http://h10025.www1.hp.com/ewfrf/wc/softwareCategory?os=4132&lc=en&cc=us&dlc=en&sw_lang=&product=5312254

    Kind regards

    Visruth

  • I bought one copy of Windows 7 Ultimate, 1 pc. Now, I need to get 6 several licenses for this copy, how can I do?

    I bought one copy of Windows 7 Ultimate, 1 pc.  Now, I need to get 6 several licenses for this copy, how can I do?

    You purchase 6 additional keys on the Microsoft Store, simply specify the quantity:

    http://www.Microsoft.com/Windows/buy/default.aspx

    http://Windows.Microsoft.com/en-us/Windows7/get-a-new-Windows-product-key

  • HP try to send me to this day that she wouldn't, take, says I need to get the Version of the Net Frame work V 2.050727, said to communicate with my editor about Apporiate version of the Net frame work.

    You need to get the update, it must get The Net Frame work V 2.050727, where can I get coming up to date, for the calculation.

    Hello

    1. do you use the 64-bit or 32-bit operating system?

    2. update you are trying to install HP?

    I suggest you to perform Windows updates.

     
    If there is an update for .NET Framework, I suggest to install the update and try to install the update from HP.
     
     
    To run Windows update manually, follow the steps:
     
    a. go to the Windows Update site. Open Internet Explorer and go to tools, Windows Update.  You must use Internet Explorer; using other browsers will result in an error message.
    b. click 'Use Administrator Options' in the menu on the left. Once the Administrator Options screen, choose to search the Windows Update Catalog under "update multiple. operaing system."
    c. install the Active X control if requested. On the screen type catalog Microsoft Update in the operating system you want updates in the area of research (for example, Vista or XP).
    d. click 'Add' next to each update you want to install. Updates will be added to your shopping cart.
    e. click on "View cart" in the upper right corner of the screen when you are finished selecting your updates. Make sure everything you want is here, and then click 'download '. In the "Download Options" popup that appears, choose where you want to download the files. A progress bar indicates the status of the downloads.
    f. navigate to the location where you downloaded the files. Double-click the files to install. You will probably be asked to restart your computer after installation is complete.
    g. to download updates for use on another computer, which is not connected to the Internet, for example, save files on removable media such as a USB drive or a disk and load the media on the computer. Double-click the files and install as you would if you downloaded them.

    If there is no update for .NET Framework, try to download and install the update manually from the link below.
     
     
    Microsoft .NET Framework Version 2.0 Redistributable Package (x 86):

    http://www.Microsoft.com/en-US/Download/details.aspx?ID=19

    I hope this helps.
  • Need to get the result of the required format

    Hi all

    I'll have the data in a table below:

    IDNUM1num2
    1555555
    2123345
    3456567
    4666666

    IDNUM1num2
    1555555
    2123345
    3456567
    4666666

    and they need to get the result as below:. Help, please...

    IDNUM
    1555
    2123
    2345
    3456
    3567
    4666

    Thanks in advance...

    Hello

    So, instead of having 2 columns on 1 row, you want to have 1 column on 2 rows.  It's just that UNPIVOT:

    SELECT DISTINCT

    ID, num

    D

    UNPIVOT (num

    FOR the label IN (num1, num2)

    )

    ORDER BY id, num

    ;

    It is more effective than the UNION, because it requires only 1 pass through the table.

  • Need to get the report of last hour in ot txt CSV cluster

    Hi all

    Thanks in advance,

    I work for a script where I need to get the information from vms that was revived by HA during the restart of the host.

    or if we can get the report of last hour in csv or txt file cluster we can extract and find out how many virtual machines has been migirated to another host for host restarts.

    Please advice.

    SIV

    Try the following, this will give you all the VMS who have been restarted and the time when it happened.

    Connect-VIServer -Server yourserver
    
    $start = (Get-Date).AddDays(-5)
    Get-VIEvent -MaxSamples 1000000 -Start $start -Type warning | Where {$_.FullFormattedMessage -Match "vSphere HA restarted"} | Select ObjectName, CreatedTime, FullFormattedMessage
    
    Disconnect-VIServer -Confirm:$false
    
  • Need to get the original values

    Hello friends,
    In my scenario, I need to get the original values
    for ex: in a single table of data lines are (R, A, J, A), in another table are given in the lines (R, A, J, E, S, H) and I need to cancel R & J where it is present in both tables. Then I need to cancel one at table 1 because there is an only A is present in table 2 and another should remain as original value. Then the County he came like 4 (A, E, S, H)

    chris227 wrote:
    any benefit here?
    OK, we know that the outer joins can be in does not exist,

    what the implementation plans

    compare the execution plan please

    for your query

    |   0 | SELECT STATEMENT           |                            |    10 |   350 |    32  (63)| 00:00:01 |
    

    and my

    |   0 | SELECT STATEMENT           |                            |    10 |   320 |     9  (56)| 00:00:01 |
    
    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
  • Need to get the result of joing the views dba

    Hello

    need to get the result of the fileds below in a database

    TABLE_NAME NOM_PARTITION NOM_TABLESPACE PARTITION_TYPE (RANGE?) PARTITION_RANGE_CONDITION SPACE_OCCUPIED_AS_OF_DATE (IN GB)

    can I know what are the points of view that I can use and application

    apprecaited for assistance

    Thank you

    Published by: user12266475 on November 2, 2011 11:33

    LONG data type is NOT friendly SQL.
    Consider the following:

    SQL> @long
    SQL> drop table test;
    
    Table dropped.
    
    SQL> create table test (id LONG);
    
    Table created.
    
    SQL> insert into test values(q'[RANGE     TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')]');
    
    1 row created.
    
    SQL> set serveroutput on
    SQL> DECLARE
      2  long_var LONG;
      3  var_var  VARCHAR2(2000);
      4  BEGIN
      5       dbms_output.enable(10000);
      6       SELECT id INTO long_var FROM test ;
      7       var_var := substr(long_var,19,19);
      8       dbms_output.put_line(var_var);
      9  END;
     10  /
    2009-01-01 00:00:00
    
    PL/SQL procedure successfully completed.
    

Maybe you are looking for

  • "Slide to Unlock" missing in iOS 10

    Got my iPhone 6 s upgraded to the new iOS10 and the kind of love him so far with a few basic things missing that are really bothering me. "Slide to Unlock", it was a legacy feature iPhone since its inception. By pressing the button Home to unlock is

  • How can I get rid of the media support is outdated question on the home page that appears each time you open Firefox?

    Everytime I open Firefox there is a window that says "media player is out of date" and won't let me not go further until I close the window, and then reopen Firefox. When I try to update, it says that it does not work for Mac.

  • Integration with 50G

    Hello! Well, when I tried to compute the definite integral of | Sin x | I received the message cannot find the signin [0, 2 ft]. I went in RPN mode, and this error persists. I then used [RS] [ENTER] to get the numeric result, and after awhile, I got

  • Questions about the sort of numbers?

    My wife is to create a database using a set of 9 numbers and wants to sort them using the "final four" of the series. Is there a a way to sort the four latest os using a series of numbers? Thanks for any help Don

  • Creation of reference for google earth activeX objects

    Hello world... I am involved in a project whose results I must represent as markers in google earth. I created the necessary kml files. I am using the class theIApplicationGE to eartth Google application interface. However, whenever I try to create a