Screening of lines that are not equal

PL/SQL version I use is 11.1.0.7.0

This is sample data

Station of Seq ID Date
__ ____ __ ______
1 3/21 / 2012-12-1206
1 2/28 / 2012 24 1712
1 2/12 / 2012 20 1105

2 3/20 / 2012 45 1206
2 2/26 / 2012 46 1206
2 2/22 / 2012 47 1206

3 3/25 / 10 / 2012 1206
3 2/18 / 12 / 2012-1105

4 4/21 / 2012-22-1105
4 4/20 / 2012 23 1105
4 2/16 / 2012 24 1105
4 2/16 / 2012 26 1105

The date for each Id is required, but only if the station code is the same for all records, if not ignore all records.

The expected result are
Station of Seq ID Date
__ ____ __ ______

2 3/20 / 2012 45 1206
4 4/21 / 2012-22-1105

Thank you
Paul
SQL> select  *
  2    from  tbl
  3  /

   ID DT               SEQ    STATION
----- --------- ---------- ----------
    1 21-MAR-12         12       1206
    1 28-FEB-12         24       1712
    1 12-FEB-12         20       1105
    2 20-MAR-12         45       1206
    2 26-FEB-12         46       1206
    2 22-FEB-12         47       1206
    3 25-MAR-12         10       1206
    3 18-FEB-12         12       1105
    4 21-APR-12         22       1105
    4 20-APR-12         23       1105
    4 16-FEB-12         24       1105

   ID DT               SEQ    STATION
----- --------- ---------- ----------
    4 16-FEB-12         26       1105

12 rows selected.

SQL> with t as (
  2             select  tbl.*,
  3                     count(distinct(station)) over(partition by id) cnt
  4               from  tbl
  5            )
  6  select  id,
  7          max(dt)
  8    from  t
  9    where cnt = 1
 10    group by id
 11    order by id
 12  /

   ID MAX(DT)
----- ---------
    2 20-MAR-12
    4 21-APR-12

SQL> 

SY.

Published by: Solomon Yakobson on 29 January 2013 13:56

Tags: Database

Similar Questions

  • Get the ROWID of lines that are not not duplicate in Oracle 10 g

    Hello

    given a table TAB1 in which the primary key is composed of the first 3 columns:

    ================================================
    colA___colB___colC___colD
    ================================================
    AA-----------------------01-----------------------20080101-----------------------100
    BX-----------------------32-----------------------20050325-----------------------366
    AA-----------------------01-----------------------20080102-----------------------645
    AA-----------------------01-----------------------20080707-----------------------765
    AB-----------------------02-----------------------20080806-----------------------336
    AB-----------------------02-----------------------20080705-----------------------543

    I want to be able to find the ROWID of these lines where colA | colB occurs only once in the table TAB1.

    So in the example above, I would like to know the ID of the containing colA = BX line and colB = 32 as "BX32" appears only once in this table (AA01 happens 3 times, AB02 occurs twice, so I'm not interested in them).

    The following does not work, but it's too SLOW:

    Select the TAB1 ROWID where colA | colB = (select colA | colB of TAB1 HAVING COUNT (*) = 1).

    Can someone please suggest an effective way to find this unique ROWID value in these circumstances?

    Published by: Nemesis on November 29, 2008 02:50

    Hi Justin:

    Thank you for your support, I didn't know that the separate symbol appears. Sorry for all :)

  • Lines that do not migrated because of filters are saved somewhere?

    Hi all

    According to my understanding, if I put a constraint on the target table in the models and use the control flow through a seam in the interface, the lines that do not meet the constraint get connected to the table of errors E$.

    I want to know that if I put some filters or join conditions on the source, the lines that are not migrated because of these filters, do they get connected anywhere. Until now, I used to check tables $ ca and my source and see that all lines have not migrate but is there any other table where the journal is maintained?

    Thank you and best regards,
    Prerna

    Hey Loren,
    You cannt see these documents. You must look in the backend... Let's say you have a filter SAL > 100 then you will get all information abot SAL<100. if="" you="" need,="" then="" you="" create="" one="" refresh="" variable="" based="" on=""><100 and="" get="" the="" count(*)="" or="" other="" possible="" information="" as="" per="">

    Bottom line: ODI will occupy on those records satisfying the condition not others.

    Thank you.
    http://bhabaniranjan.com/

  • Help - why the songs that are not on my iPhone appearing in my list of app music albums/songs?

    I have over 500 GB of music on my Mac, so I create a playlist for the songs I want to sync my iPhone. Yet when I look at my phone, there are many songs that are not in sync would be playlist. They cannot be read unless the phone is connected to my wifi at home, but I don't want them cluttering up my phone and makes it almost impossible to find the tracks I want to listen to.

    I hate the new music app. For the first time since I converted to Apple 10 years ago, I wonder if I can be forced away because it's so horrible. Why ruin a great product with terrible software? Anyway, if anyone can help me to fix this serious bug, I would be very grateful.

    If you go to the library of the screen and press the red text just below the icons of the album/playlist (where you select whether you want the screen to show the view of the artist/Album/songs downstairs there is a toggle to only show that downloaded music.) If you enable this, then only the songs that are actually ON your iPhone will be in BLACK characters. The rest of your music library to iCloud either won't display at all or be grey. Now - if you have a few streaming, you can see more songs, because the songs that are heard are cached in the memory of the iPhone box and supposedly deleted automatically when it fills up (but not user accessible unless you use some third-party programs).

    What you can do - so they need WiFi or data cell-, it's make a playlist in iTunes that you want on your iPhone. Then (assuming that Apple music and iCloud music library are running on both), you can go to the playlist and press the small cloud/down arrow icon and download these tracks on your iPhone. Then, you can play these songs without access to wifi or cell phone.

  • PowerShell: The AD search for computers that are not members of multiple groups

    I'm writing a Powershell script that AD for computers that are NOT a member of a research group.  Basically, it's a maintenance task that will display a list of computers that have been added to the field incorrectly.  When I paste the below line by line in powershell, I get the expected results.  When I try to run it from a .ps1 Export-csv file is created with 0 bytes.  Any help would be appreciated.

    #import - module ActiveDirectory
    Get-ADComputer - LDAPFilter.
    (&(!
    (memberof = "WSUS1")
    ))
    (&(!
    (memberof = "WSUS2")
    ))
    (&(!
    (memberof = "WSUS3")
    ))
    (&(!
    (memberof = "WSUS4")
    ))
    (&(!
    (memberof = "WSUS5")
    ))
    (&(!
    (memberof = "WSUS6")
    ))
    (&(!
    (memberof = "WSUS7")
    ))
    (&(!
    (memberof = "WSUS8")
    ))
    (&(!
    (memberof = "WSUS9")
    ))
    (&(!
    (memberof = "WSUS10")
    ))
    (&(!
    (memberof = "WSUS11")
    ))
    (&(!
    (memberof = "WSUS12")
    ))
    (&(!
    (memberof = "WSUS13")
    ))
    (&(!
    (memberof = "WSUS14")
    ))
    (&(!
    (memberof = "WSUS15")
    ))
    (&(!
    (memberof = "WSUS16")
    ))
    (&(!
    (memberof = "WSUS17")
    ))
    " | Select name. Export-csv "D:\temp\Wsus_computers $(get-date-f_yyyy-MM-DD).csv".

    Hello

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums for assistance:

    MSDN forums for the development of Windows desktop

    Let us know if you need help with Windows related issues. We will be happy to help you.

  • Filtering of fields that are not primary keys

    Hello

    I want to do a search, filtering of fields that are not the primary key. I want to do it by using entities and no views. Is this possible? How I do that?

    I saw a 'findByPrimaryKey' method call, but this can be used to find by primary key.

    Is there another method to perform searches using entities (not seen)?

    Thank you

    This is not sensible.
    An entity represents only one line. A view in means of the framework represents zero or more entities. A search may return zero, one or several entities. Research is conducted through views (display objects), not on the entities.
    I see no reason not to use views to filter entities (lines). If you must explain why you do not use the objects in view.

    Timo

  • get rid of lines that are completely understood by the other lines

    using oracle 10 g

    I have a requirement where I have a few groups that have a start date and end date, and
    I don't know how many lines per group, it is dynamic.

    I need to get rid of all the lines that are completely understood by the other lines per group
    To tell if an online group has started on January 1, 2000 and ending on January 1, 2001
    and another group line begins February 1, 2000 and ends at 2000 1 dec
    only the line Jan to Jan should appear.

    so, for
    with t as
    (
        select 'A' grp, 1 id, to_date('01-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-01-2001', 'MM-DD-YYYY') end_dt from dual union all
        select 'A' grp, 2 id, to_date('02-01-2000', 'MM-DD-YYYY') start_dt, to_date('12-01-2000', 'MM-DD-YYYY') end_dt from dual union all
        select 'A' grp, 3 id, to_date('03-01-2000', 'MM-DD-YYYY') start_dt, to_date('12-10-2000', 'MM-DD-YYYY') end_dt from dual union all
        select 'A' grp, 4 id, to_date('07-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-10-2001', 'MM-DD-YYYY') end_dt from dual union all
        select 'A' grp, 5 id, to_date('01-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-01-2001', 'MM-DD-YYYY') end_dt from dual 
     )
    I don't want to see
    GRP,ID,START_DT,END_DT
    A,1,1/1/2000,1/1/2001
    A,4,7/1/2000,1/10/2001
    Published by: pollywog on July 20, 2010 11:49

    Published by: pollywog on July 20, 2010 11:56

    Published by: pollywog on July 20, 2010 11:56

    Well, I do not get the exact release you do, but I'm sure that this complies with your verbal condition.

    You may have a fault in your output specified? It is also quite possible, that there is something wrong with my query :)

    with
       t as
    (
       select 'A' grp, 1 id, to_date('01-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-01-2001', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 2 id, to_date('02-01-2000', 'MM-DD-YYYY') start_dt, to_date('12-01-2000', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 3 id, to_date('03-01-2000', 'MM-DD-YYYY') start_dt, to_date('12-10-2000', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 4 id, to_date('07-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-10-2001', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 5 id, to_date('01-01-2000', 'MM-DD-YYYY') start_dt, to_date('01-01-2001', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 6 id ,to_date('12-25-1999', 'MM-DD-YYYY') start_dt, to_date('01-05-2001', 'MM-DD-YYYY') end_dt from dual union all
       select 'A' grp, 7 id, to_date('02-01-2001', 'MM-DD-YYYY') start_dt, to_date('02-01-2001', 'MM-DD-YYYY') end_dt from dual
    )
    select
       grp,
       id,
       start_dt,
       end_dt,
       last_start_dt,
       last_end_dt
    from
    (
       select
          lag(start_dt)   over (partition by grp order by start_dt asc)  as last_start_dt,
          lag(end_dt)     over (partition by grp order by start_dt asc)  as last_end_dt,
          grp,
          id,
          start_dt,
          end_dt
       from
          t
    )
    where last_start_dt is null
    or
    not
    (
             start_dt  between last_start_dt and last_end_dt
       and   end_dt    between last_start_dt and last_end_dt
    )
    order by start_dt asc;
    
    G                 ID START_DT             END_DT               LAST_START_DT        LAST_END_DT
    - ------------------ -------------------- -------------------- -------------------- --------------------
    A                  6 25-DEC-1999 12 00:00 05-JAN-2001 12 00:00
    A                  3 01-MAR-2000 12 00:00 10-DEC-2000 12 00:00 01-FEB-2000 12 00:00 01-DEC-2000 12 00:00
    A                  4 01-JUL-2000 12 00:00 10-JAN-2001 12 00:00 01-MAR-2000 12 00:00 10-DEC-2000 12 00:00
    A                  7 01-FEB-2001 12 00:00 01-FEB-2001 12 00:00 01-JUL-2000 12 00:00 10-JAN-2001 12 00:00
    
    4 rows selected.
    
  • I want to see just all the Photos that are not in an album - possible?

    Hello

    is it possible to see all the photos that are not in the album?

    Photo on Mac

    THX

    Stefan

    Yes, create smart albums with the rule 'Album isn't everything. "

    For the file menu: file > new Smart album

    This album will contain all the photos that are not in any standard album.

  • How to remove e-mail messages. No icon in my tray tasks and how to remove several e-mail messages that are not consecutively

    First of all, I can't find a top of icon delete or bottom or anywhere. Secondly, when I'll be that solved how can I remove a number of emails that are not in consecutive order.

    You can click with the right button on the e-mail toolbar, select Customize, find the Delete button and drag it to the toolbar.
    You can activate the message pane by using the F8 key and use this header button.
    You can right-click on the message and select Remove.
    You can also use the Delete on your keyboard key.

    To select the messages you use standard Windows selection methods.
    Hold down the control key while clicking on messages to select random messages.

  • How can I see the photos that are not in an album?

    How can I see the photos that aren't in an album in the App "Photos"? I noticed that in the Album 'Pictures' are pictures I thought I deleted already. I would like to see all the photos in an album, so I can finally delete them.

    You can go the the file menu Photos and click New Smart Album, and then set the condition of Album - is not. This will create a smart album that will show you all the photos that are not in any other album.

  • IPad disabled with thousands of pictures of children that are not backed up with iTunes or icloud. Recommendations for the recovery of photos please?

    IPad disabled with thousands of pictures of children that are not backed up with iTunes or icloud. Recommendations for the recovery of photos please?

    Sorry, but if your device is disabled and you have no backup, then you won't be able to save the data on the device:

    https://support.Apple.com/en-us/HT204306

    You should back up your device regularly to iCloud or import your photos to an application on your computer. Otherwise, you will be risking losing those photos. If your device has been lost, stolen, or crushed by your car, you'd be in the same situation. Really sorry for your photos.

    Good luck

    GB

  • This playlist cannot be downloaded because it includes other types of media or songs that are not eligible.

    iCloud music library playlists can include music from your music library to iCloud. This playlist cannot be downloaded, because it includes other types of media or songs that are not eligible.

    What does that mean? I have iTunes game and not really encountered problems previously? I don't understand why I get this message? I'm just trying to create a playlist. Other playlists seem to be OK?

    Hello

    The playlist includes either a music file not for example PDF or a music file that is not eligible. Add iCloud status column to your playlist (view of the song) and it will tell you what is unacceptable.

    JIm

  • I'm trying to restore a deleted from iTunes purchase? It is said that purchase that it does not DOWNLOAD when I go to see my purchase that are not on my iPhone.

    I'm trying to restore a deleted from iTunes purchase? It is said that purchase that it does not DOWNLOAD when I go to see my purchase that are not on my iPhone.

    If its not displayed in the tab purchased in the iTunes store app (audiobooks and tones will not appear, they are only unique downloads of the store) and check if you have hidden it cloud: mask and unmask purchases iTunes or iBooks on your Mac or PC - Apple support

  • Read VeriStand channel from inside the custom device that are not part of the custom device?

    Is it possible to read VeriStand channels from within a custom device VeriStand (RT Driver) that are not part of this custom device?

    For example, suppose I want to be able to configure a channel in my custom device to always be twice the value of a string of material that my user selects (I know, better/more simple ways to do this, but this is just a simple example ).  Can I do this from the device custom without programmatically create a mapping of the system? (I've done this before and it is messy and VERY prone to error of the user).

    Thank you!

    good point

    the channel ID (U64s) are not the same in the engine config of vs. Instead, you must set 'references to dependent item' in the config and then get these references in the engine.

    See the source jarrod linked, which makes it

  • Show files that are not removed

    Hello world!

    I need to find a way to display the files that are not deleted, but my code shows me just the last file that is not deleted...

    (True and false are written in red, because I use a french version of Labview )

    If anyone can help... Thanks in advance for your answer!

    crossrulz wrote:

    Something like this should work.

    Or if you want to keep this code on a postage stamp, you can use the tunnel contitional feature introduced in LabVIEW 2012.

    Come on Tim, get with the times

Maybe you are looking for

  • Play mp4 and memories home

    I have several cameras... few Sony and some others. When I load and import a memory of a Samsung camera for example, card play memories home any still images, but not the videos (which are in mp4 format). For this not even acknowledge them. Is there

  • Double-passing the path to LV

    Hi, I have to spend some trail of TS to LV I've always used the double slash. Is possible to use only one '-'? If I do the chain gets LV is different from the original. I know that the "------" is a special character and behaviour varies according to

  • QNetworkRequest Basic authorization

    Hello I'm trying to REST the call with the base permission // Creates the network request and sets the destination URL. QNetworkRequest request = QNetworkRequest(QUrl(strURL)); request.setRawHeader("Content-Type", "application/x-www-form-urlencoded")

  • Problem with Muse "Menu.

    HelloFor a long time, I work with Muse.This is the first time, it does not work...I add a new page. It appears in the "Menu", but it does not work when clicked on.I can't access online (per the Menu) for this new pageThank you for your reply and sorr

  • The bank information.

    Hello, I need help for the plan I bought; I need to change my bank details but when I try to go in the link to change my account information it shows me nothing... I have a Macbook. Thank you.