Remove all duplicate records and load into temp table

Hi
I have a table contains data like this.
Emp No Designation location
1111 SE CA
1111 DE CT
3456 WE NJ
4523 TY GH
We found that there are two duplicate records for emp no: 1111. I want to delete all duplicate records (in this case two records for emp no:1111) and load into the temp table.
Please advice me how to do it.

Oh look, you can search the forums...
http://forums.oracle.com/forums/search.jspa?threadID=&q=delete+duplicates&objID=f75&dateRange=all&userID=&numResults=30

Similar Messages

  • Sharpener Pro 3 has problems in Aperture as the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Have removed all duplicate fonts and tried using a new user account. Any ideas?

    I am experiencing problems with Sharpener Pro 3 as an Aperture 3 plug-in. These are:  the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Following discussions with Nik Software I have removed all duplicate fonts and tried using a new user account. Neither of the courses of action worked. Have other users experienced these difficulties? Can you suggest an alternative remedy?

    I am experiencing problems with Sharpener Pro 3 as an Aperture 3 plug-in. These are:  the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Following discussions with Nik Software I have removed all duplicate fonts and tried using a new user account. Neither of the courses of action worked. Have other users experienced these difficulties? Can you suggest an alternative remedy?

  • This field contains duplicate values. Remove all duplicate values and try the operation again.

    Greetings Everyone,
    I am getting the follow up errors: "This field contains duplicate values. Remove all duplicate values and try the operation again."
    when I tried to make the field "Claim Number" from the list in site collection library. See the screen below:
    1- I selected on the "List" and I clicked on the list name
    "Claim Tracking Report"
    2- After I clicked on the list name then I went to the ribbon and selected list setting to choose Enforce Unique for the Field Column
    "Claim Number"
    3- Then I went down and selected
    "Yes" to Enforced the Unique for the Field Column "Claim Number".
    4- Then after I clicked "Yes" I got the error
    "Sorry, something went wrong. This field contains duplicate values. Remove all duplicate values and try the operation again."  But I don't have any duplicates values Items, because I had them removed before I tried
    to Enforce the field column values to Unique. Can someone help or provide me a suggestions on how I can solve this issue please. Thank you
    FYI: I am using a Nintex Workflow

    Hope this is a list, how many total items are there?
    Please try to open this list as access(link in IE) and run this query in access
    SELECT Claim.[Claim Number], Count(*) AS Expr1
    FROM Claim
    GROUP BY Claim.[Claim Number]
    HAVING (((Count(*))>1));
    Hope it will show something! if this does not show you dups then better to create a separate list and migrate items after configuring unique column.
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Extracting explanations from planning app and loading into Oracle table

    Hi All,
    I had a requirement where I had to extract data from a planning application through ODI 11g and load it into Oracle RDBMS.
    I used essbase as my source in technology (since planning data is stored on essbase side) and oracle as my target.
    Now the data is getting extracted from essbase side and is getting loaded into Oracle table through ODI.
    Now the client requires that they want to extract the explanations or text values also from planning application and load them into Oracle table.
    How this can be achieved?Is there a table on the sql side(since sql database is being used at back end for planning app) which stores the explanations,if yes please let me know which table it is.
    Kindly help me with this requirement.

    Hi,
    IKM SQL Control Append is perfect if you don't need incremental updates. If you need it, go for IKM Oracle Incremental Update (MERGE) or something like that.
    Regards,
    JeromeFr

  • Avoiding duplicate records while inserting into the table

    Hi
    I tried the following insert statement , where i want to avoid the duplicate records while inserting itself
    but giving me the errror like invalid identifier, though the column exists in the table
    Please let me know Where i'm doing the mistake.
    INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
       SELECT 100,
              sk.obj_id,
              sk.key_txt,
              sk.obj_typ,
              sysdate,
              FROM S_KEY sk
        WHERE     sk.obj_typ = 'AY'
              AND SYSDATE BETWEEN sk.start_date AND sk.end_date
              AND sk.obj_id IN (100170,1001054)
               and   not exists  (select 1
                                                                   FROM t_map tm1 where tm1.O_ID=tm.o_id
                                                                        and tm1.sn_id=tm.sn_id
                                                                        and tm1.txt=tm.txt
                                                                        and tm1.typ=tm.typ
                                                                        and tm1.sn_time=tm.sn_time )

    Then
    you have to join the table with alias tml where is that ?do you want like this?
    INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
       SELECT 100,
              sk.obj_id,
              sk.key_txt,
              sk.obj_typ,
              sysdate,
              FROM S_KEY sk
        WHERE     sk.obj_typ = 'AY'
              AND SYSDATE BETWEEN sk.start_date AND sk.end_date
              AND sk.obj_id IN (100170,1001054)
               and   not exists  (select 1
                                                                   FROM t_map tm where sk.obj_ID=tm.o_id
                                                                        and 100=tm.sn_id
                                                                        and sk.key_txt=tm.txt
                                                                        and sk.obj_typ=tm.typ
                                                                        and sysdate=tm.sn_time )

  • How to read data and load into a table

    Hi,
    I have a client requirement as below.
    Client will send the xmlpayload, based on this xml I want to read the data and store it into a database table. Could you please let me know how to achieve this functionality.
    sample xmlpayload:
    <gesws:localeAndSend xmlns:gesws="https://services.gmail.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://services.gmail.com docs/xsd/localeandsend.xsd" schemaVersion="1.0">
    <gesws:localer>
    <gesws:divisionstate>localeD</gesws:divisionstate>
    <gesws:division>Retail</gesws:division>
    <gesws:attributes>
    <gesws:attribute>
    <gesws:name>email</gesws:name>
    <gesws:value>[email protected]</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>firstName</gesws:name>
    <gesws:value>Robin</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>lastName</gesws:name>
    <gesws:value>Dan</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>postalCode</gesws:name>
    <gesws:value>56302</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>Mobileapp</gesws:name>
    <gesws:value>-6</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>CodedString</gesws:name>
    <gesws:value>1550</gesws:value>
    </gesws:attribute>
    <gesws:attribute>
    <gesws:name>CodedBoolean</gesws:name>
    <gesws:value>true</gesws:value>
    </gesws:attribute>
    </gesws:attributes>
    </gesws:localer>
    <gesws:localerMessage>
    <gesws:mId>120098</gesws:mId>
    </gesws:localerMessage>
    </gesws:localeAndSend>
    Thanks in advance

    You can use XMLTABLE to extract data from your XMLTYPE datatype...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select xmltype('<gesws:localeAndSend xmlns:gesws="https://services.gmail.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      2  xsi:schemaLocation="https://services.gmail.com docs/xsd/localeandsend.xsd" schemaVersion="1.0">
      3    <gesws:localer>
      4      <gesws:divisionstate>localeD</gesws:divisionstate>
      5      <gesws:division>Retail</gesws:division>
      6      <gesws:attributes>
      7        <gesws:attribute>
      8          <gesws:name>email</gesws:name>
      9          <gesws:value>[email protected]</gesws:value>
    10        </gesws:attribute>
    11        <gesws:attribute>
    12          <gesws:name>firstName</gesws:name>
    13          <gesws:value>Robin</gesws:value>
    14        </gesws:attribute>
    15        <gesws:attribute>
    16          <gesws:name>lastName</gesws:name>
    17          <gesws:value>Dan</gesws:value>
    18        </gesws:attribute>
    19        <gesws:attribute>
    20          <gesws:name>postalCode</gesws:name>
    21          <gesws:value>56302</gesws:value>
    22        </gesws:attribute>
    23        <gesws:attribute>
    24          <gesws:name>Mobileapp</gesws:name>
    25          <gesws:value>-6</gesws:value>
    26        </gesws:attribute>
    27        <gesws:attribute>
    28          <gesws:name>CodedString</gesws:name>
    29          <gesws:value>1550</gesws:value>
    30        </gesws:attribute>
    31        <gesws:attribute>
    32          <gesws:name>CodedBoolean</gesws:name>
    33          <gesws:value>true</gesws:value>
    34        </gesws:attribute>
    35      </gesws:attributes>
    36    </gesws:localer>
    37    <gesws:localerMessage>
    38      <gesws:mId>120098</gesws:mId>
    39    </gesws:localerMessage>
    40  </gesws:localeAndSend>') as xml from dual)
    41  --
    42  -- end of test data
    43  --
    44  select x.mID, x.divisionstate, x.division
    45        ,y.att_name, y.att_val
    46  from   t
    47        ,xmltable(xmlnamespaces('https://services.gmail.com' as "g")
    48                 ,'g:localeAndSend'
    49                 passing t.xml
    50                 columns mID           number       path './g:localerMessage/g:mId'
    51                        ,divisionstate varchar2(10) path './g:localer/g:divisionstate'
    52                        ,division      varchar2(10) path './g:localer/g:division'
    53                        ,atts          xmltype      path './g:localer/g:attributes'
    54                 ) x
    55        ,xmltable(xmlnamespaces('https://services.gmail.com' as "g")
    56                 ,'g:attributes/g:attribute'
    57                 passing x.atts
    58                 columns att_name      varchar2(20) path './g:name'
    59                        ,att_val       varchar2(20) path './g:value'
    60*                ) y
    SQL> /
           MID DIVISIONST DIVISION   ATT_NAME             ATT_VAL
        120098 localeD    Retail     email                [email protected]
        120098 localeD    Retail     firstName            Robin
        120098 localeD    Retail     lastName             Dan
        120098 localeD    Retail     postalCode           56302
        120098 localeD    Retail     Mobileapp            -6
        120098 localeD    Retail     CodedString          1550
        120098 localeD    Retail     CodedBoolean         true
    7 rows selected.
    SQL>Once you're getting the data out, you can do what you want with it, e.g. pivot it to a single row...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select xmltype('<gesws:localeAndSend xmlns:gesws="https://services.gmail.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      2  xsi:schemaLocation="https://services.gmail.com docs/xsd/localeandsend.xsd" schemaVersion="1.0">
      3    <gesws:localer>
      4      <gesws:divisionstate>localeD</gesws:divisionstate>
      5      <gesws:division>Retail</gesws:division>
      6      <gesws:attributes>
      7        <gesws:attribute>
      8          <gesws:name>email</gesws:name>
      9          <gesws:value>[email protected]</gesws:value>
    10        </gesws:attribute>
    11        <gesws:attribute>
    12          <gesws:name>firstName</gesws:name>
    13          <gesws:value>Robin</gesws:value>
    14        </gesws:attribute>
    15        <gesws:attribute>
    16          <gesws:name>lastName</gesws:name>
    17          <gesws:value>Dan</gesws:value>
    18        </gesws:attribute>
    19        <gesws:attribute>
    20          <gesws:name>postalCode</gesws:name>
    21          <gesws:value>56302</gesws:value>
    22        </gesws:attribute>
    23        <gesws:attribute>
    24          <gesws:name>Mobileapp</gesws:name>
    25          <gesws:value>-6</gesws:value>
    26        </gesws:attribute>
    27        <gesws:attribute>
    28          <gesws:name>CodedString</gesws:name>
    29          <gesws:value>1550</gesws:value>
    30        </gesws:attribute>
    31        <gesws:attribute>
    32          <gesws:name>CodedBoolean</gesws:name>
    33          <gesws:value>true</gesws:value>
    34        </gesws:attribute>
    35      </gesws:attributes>
    36    </gesws:localer>
    37    <gesws:localerMessage>
    38      <gesws:mId>120098</gesws:mId>
    39    </gesws:localerMessage>
    40  </gesws:localeAndSend>') as xml from dual)
    41  --
    42  -- end of test data
    43  --
    44  select mID, divisionstate, division
    45        ,max(decode(att_name, 'email', att_val)) as email
    46        ,max(decode(att_name, 'firstName', att_val)) as firstname
    47        ,max(decode(att_name, 'lastName', att_val)) as lastname
    48        ,max(decode(att_name, 'postalCode', att_val)) as postalcode
    49        ,max(decode(att_name, 'CodedString', att_val)) as codedstring
    50        ,max(decode(att_name, 'CodedBoolean', att_val)) as codedboolean
    51  from (
    52        select x.mID, x.divisionstate, x.division
    53              ,y.att_name, y.att_val
    54        from   t
    55              ,xmltable(xmlnamespaces('https://services.gmail.com' as "g")
    56                       ,'g:localeAndSend'
    57                       passing t.xml
    58                       columns mID           number       path './g:localerMessage/g:mId'
    59                              ,divisionstate varchar2(10) path './g:localer/g:divisionstate'
    60                              ,division      varchar2(10) path './g:localer/g:division'
    61                              ,atts          xmltype      path './g:localer/g:attributes'
    62                       ) x
    63              ,xmltable(xmlnamespaces('https://services.gmail.com' as "g")
    64                       ,'g:attributes/g:attribute'
    65                       passing x.atts
    66                       columns att_name      varchar2(20) path './g:name'
    67                              ,att_val       varchar2(20) path './g:value'
    68                       ) y
    69       )
    70  group by mID, divisionstate, division
    71* order by 1
    SQL> /
           MID DIVISIONST DIVISION   EMAIL                FIRSTNAME            LASTNAME             POSTALCODE           CODEDSTRING          CODEDBOOLEAN
        120098 localeD    Retail     [email protected]    Robin                Dan                  56302                1550                 true

  • CTE into temp table

    I have query with many CTE:
    ;WITH CTE AS(...), CTE1 AS(....), CTE2 AS (...), CTE3 AS(...)
    CTE4 AS(...), CTE5 AS(...), CTE6 AS(...), CTE7 AS(...), CTE8 AS(...), CTE9 AS(...), CTE10 AS(...), CTE11 AS(...)
    SELECT * FROM CTE9 INNER JOIN CTE11 ON....
    The last select works 3 minutes, but until CTE11 everything works in 1 second.
    Is it possible to store CTE9 and CTE11 into temp table? (the same select form temp tables would execute immediately)
    CTE9 and CTE11 has inside access to previous CTE's, so I can't break the query before CTE11 unless I create every CTE as temp table.

    "I think it is too fragile."
    If I store in physical table instead of temp table than if server go down, at least I will
    have my data stored.
    And it is not critical if this records are not available in main table for some time.
    It could be solution, but requires some maintenance work in case server goes down or any other
    uncatchable error .
    But i guess I will just disable escalation.
    My problem is quite simple. I have table "dbo.Stock" where is stock of products in warehouse. Lets say 1 million of products with some quantity. Each quantity of product has some ownership.
    For example: i have quantity 1000 of product A. 500 quantity belongs to company1, 300 to company2 and 200 to company3.
    Then at some time, I have to rearrange the ownership of lets say 200000 products(20%). (could be any number, more or less).
    Until new ownership is not known, this stock should not be available for any operation - so, it is no problem, if this stock doesn't exists in table "dbo.Stock" at calculation time. But for other stock(800.000 products) all operations must be available.
    So, i move(delete) this 200.000 products out of stock table and calculate ownership. This calculation
    runs for 10 minutes. Then I move this stock back to the table(PK of most of the records is different now, so couldn't be update anyway).
    Can you image that this table is locked for 10 minutes and it is very frequent one? Everything would stop for 10 minutes and i will get fired :)
    What function? Do you have some description? I'm curious, maybe get some idea :)
    Thanks,
    Simon

  • Removing Duplicate Records  and Merging with the previous record

    Hi
    Can any one help me in doing this..
    I want to delete a duplicate record from the current table.If there is one more record of the same kind. Compare the two records and fill the columns which are empty. Then Merge it. and Remove the duplicate record...Before deleting the record move it into the backup table..
    with regards
    srikanth

    I understand conceptually what you're after. At a detailed level, though, you're going to have to enunciate some specific rules to enforce.
    1) What makes row A a duplicate of row B? Is it just the Name column? Some combination of columns? Something else?
    2) What is the exact rule for merging rows? Among other questions
    - If you have multiple non-NULL values for a particular column, which column wins? If you have one row that is Manchester, NH and one that is Nashua, NH, which would you keep?
    - Does the merge logic depend on the particular column (i.e. perhaps you want the city & state to come from one row whereas first and last name can come from different rows)
    Justin

  • HT1711 I have all of my music loaded into iTunes and now I can only play iTunes songs.  Can anyone tell me why?

    I have all of my music loaded into iTunes but can only play the songs that I bought through iTunes.  Am I doing something wrong or can I only use the iTunes player for iTunes music?

    From my post on what seems like the same issue (found here: https://discussions.apple.com/message/21087892#21087892)
    Take the following steps:
    1) while connected to wifi, toggle off then back on the Show All Music and iTunes Match options shown in my original post. Important: I did this step before, but wasn't connected to wifi, and my music disappeared. Subsequently, I connected to wifi and turned off and then back on those options and everything came back though it was grayed out and my only option was to download music.
    2) To get streaming over cellular back, go into Settings>General>Cellular and scroll down to the "Use Cellular Data for:" options and make sure the iTunes option is set to 'On'
    The above steps will bring back the streaming capability which seemed to go away when you update to 6.1. It didn't ACTUALLY go away, but something about the update toggled off the iTunes option in step 2 above.
    I did a final test by turning off wifi, opening Music app and selecting a song. It played successfully without downloading! Crossing my fingers, but I think I'm good to go!
    Hope this helps!

  • Remove all duplicate photos

    How can I remove all duplicate photos from all my albums on revel?

    I believe that this is related to iTunes. When iTunes loads the photos to the phone, it downsamples photos synced to the phone, which means they are not the same size, and therefore are not exactly the same photo from revel's point of view. To Visually, these files look the same, but Revel regards them as unique files and imports them.
    We first do an "import" which brings in the small previews so you can see them. We finish that numbered countdown THEN we upload the originals and say we are "syncing" .When cloudy (the little cloud icon)  is working, you should have the chasing arrows. If they exit the  Revel app while we are uploading we continue to upload for 10 min in the background and then stop and issue a notification.If you start a big upload and minimize Revel to the tray and never go back into Revel, Delete the photos from the device, THEN go back into Revel, then you get into this situation.
    You should only delete things off the device once cloudy indicates the "library is up to date"   You can check this by opening the library and noticing if there is a cloudy status in the library view. If there isn't a cloud icon you can check the settings panel and see cloudy there. If originals haven't uploaded completely on the device, then cloudy will be in the library view and indicate activity.
    Here are our suggestions:
    1.Ensure all original photos are safely backed up outside of Revel (eg, saved on the desktop, external hard drive, etc.)
    2. Going forward, please keep Revel open and running, until the sync is complete. (click on the cloud icon to see upload status)
    3. If it’s important to preserve the original images in Revel cloud storage rather than the downsized ones from itunes, you will need to remove images that now have or did ever have duplicates, and upload the photos again.  Since iTunes syncing can’t copy originals back to the device, this means you will need to upload from the Revel Mac app, or upload from your computer (Mac or Win) by signing into your account in a web browser at www.adoberevel.com .
    Pattie

  • Why does a ringtone sync want to remove all my music and video

    I downloaed an app to make a ringtone from my music on my iphone 4
    I made the ringtone and got it onto the desktop of my laptop then into the itunes ringtones folder but if i try to then sync it onto the iphone i am prompted that it will remove all the music and video from the iphone.
    What setting do i have here that won't allow me to add a ringtone sync without clearing my iphone?
    If its not a setting how do i get around it?

    Thanks very much
    I've just realised what a nugget I've been for not just trying that last night.
    I drag and drop all my music and video so why not drag and drop this also.
    I would be merciless in my teasing of someone for this very thing so feel free to give it to me loads.

  • How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi?

    How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi? There is probably a trivial, easy way to get this info, but I have not yet found it!  Thanks..

    Or if you want to grab all the paths programatically, try the attached VI.
    Open the top level that you want all the paths from and close all others, then open the
    attached and run it. It will return an array of all the VIs that the VI
    in question uses, including vi.lib VIs. You can filter these as well if
    you like.
    Ed
    Message Edited by Ed Dickens on 08-01-2005 07:01 PM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Get all paths.vi ‏29 KB

  • How do I remove all duplicate images from my IPad 4? They are clogging up hard drive

    I have a lot of images on this iPad  from a major journey that i am on. Most are.in albums.. I want to further organise them but many have randomly duplicated. Some several times over. These images have filled up the hard drive as a result. So I cannot continue to organise the images. I have tried to use photomanager pro in order to set up sub folders, but cannot import the media as dive is full. Please can someone advise how to 1. Remove all duplicates and 2. Avoid repetition of this situation.
    Thanks....

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • How do i remove all the songs and pictures from my ipod nano?

    the first time i connected my ipod to my computer, all the songs that were on the computer went into itunes by themselves and went onto my ipod. i want to remove all the songs and photos that i have on my ipod and in itunes. can someone tell me how to do that please?!

    You can put your iPod in manual mode. Here is the site.
    http://docs.info.apple.com/article.html?artnum=61148
    Select either 'Music' tab or 'Photo' tab whichever you prefer to work with first. Within either tab you pick what actions you want to take place.

  • Return all duplicate record

    hi how can i return all duplicate records, not just the records which is duplicate, can you check my query
    select c_code,facility_name,npo_registration_no,AGR.CONTRACT_NO
    ,ssch.name subsidy,SSCH.SUB_PROGRAMME, organisation,opex_allocation
    from sms_parties par
    ,sms_agreements agr
    ,SMS_SUBSIDY_SCHEMES_VW ssch
    ,sms_agreement_years ayea
    ,sms_agreement_status asta
    ,sms_fyea_open_vw fyea
    where par.id = agr.par_id
    and agr.id = ayea.id (+)
    and agr.contract_no like '%2011%'
    and ayea.asta_id = asta.id (+)
    and agr.ssch_id = SSCH.SSCH_ID
    and npo_registration_no in (
    select npo_registration_no
    from sms_parties
    group by npo_registration_no
    having count(*) > 1
    order by 1
    Edited by: user603350 on 2011/08/25 5:30 PM

    select *
    from (
      select c_code
            ,facility_name
            ,npo_registration_no
            ,AGR.CONTRACT_NO
            ,ssch.name subsidy
            ,SSCH.SUB_PROGRAMME
            ,organisation
            ,opex_allocation
            ,row_number() over ( partition by c_code
                                          ,facility_name
                                          ,npo_registration_no
                                          ,AGR.CONTRACT_NO
                                          ,ssch.name subsidy
                                          ,SSCH.SUB_PROGRAMME
                                          ,organisation
                                          ,opex_allocation
                                 order by npo_registration_no) rn
            ,count(1) over ( partition by c_code
                                          ,facility_name
                                          ,npo_registration_no
                                          ,AGR.CONTRACT_NO
                                          ,ssch.name subsidy
                                          ,SSCH.SUB_PROGRAMME
                                          ,organisation
                                          ,opex_allocation) cn
      from   sms_parties par
            ,sms_agreements agr
            ,SMS_SUBSIDY_SCHEMES_VW ssch
            ,sms_agreement_years ayea
            ,sms_agreement_status asta
            ,sms_fyea_open_vw fyea
      where  par.id             = agr.par_id
      and    agr.id             = ayea.id (+)
      and    agr.contract_no    like '%2011%'
      and    ayea.asta_id       = asta.id (+)
      and    agr.ssch_id = SSCH.SSCH_ID
    where rn != 1
    and   cn > 1
    order by 1or
    select *
    from (
      select c_code
            ,facility_name
            ,npo_registration_no
            ,AGR.CONTRACT_NO
            ,ssch.name subsidy
            ,SSCH.SUB_PROGRAMME
            ,organisation
            ,opex_allocation
            ,row_number() over ( partition by npo_registration_no
                                 order by npo_registration_no) rn
            ,count(1) over ( partition by npo_registration_no) cn
      from   sms_parties par
            ,sms_agreements agr
            ,SMS_SUBSIDY_SCHEMES_VW ssch
            ,sms_agreement_years ayea
            ,sms_agreement_status asta
            ,sms_fyea_open_vw fyea
      where  par.id             = agr.par_id
      and    agr.id             = ayea.id (+)
      and    agr.contract_no    like '%2011%'
      and    ayea.asta_id       = asta.id (+)
      and    agr.ssch_id = SSCH.SSCH_ID
    where rn != 1
    and   cn > 1
    order by 1Included both as I'm not sure about your logic, but you'll have to play around with the PARTITION BY window.
    UNETSTED!

Maybe you are looking for

  • Mac Mini Won't Boot after 2008 008 Security Update

    I have 2 mac mini's both identical systems - ran the security update at home - rebooted and noticed the movements of the mouse and the mail application was 1/2 to a second slow/behind - decided to restart - it took 3 restarts and it finally came back

  • Ipod needs to be restored but not quite so simple

    my ipod 30gig video said it was corrupt after a week or so of use, so i pressed the restore button in itunes as advised. i get all the warnings about losing all my data and such. i press ok and continue, it tells me its recovering it. then recovery i

  • Error - 5.7.0 From address is not one of your addresses.

    I have recently started a new job (yeah!) and am trying to configure my G4 to send and receive work emails. I am using the work server to retrieve emails and need to use my home smtp server to send. I am using .mac (which may be the problem) and Ento

  • WORKSPACE export not exporting Applications?

    When I export my workspace from the admin it doesn't export the applications. It only exports the following: -- Company, user group and user export Any suggestions?

  • Port 9iAS from NT to Solaris

    What are the issues that you may face while porting 9iAS from NT to UNIX with Oracle Developer 6 applications deployed on 9iAS