Please help me in Merging the Persons Together by assining the same id

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
Please Help Me
We_addr_id defines the Address.
We_pid     Defines the Person.
i am planning to merge the same person together by assigining the same we_pid.
WITH merge_names AS (SELECT   1000 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              'L' middle_name,
                              NULL Suffix FROM DUAL
                              UNION ALL
                              SELECT   1001 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              'LARRY' middle_name,
                              NULL Suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   1002 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              NULL middle_name,
                              NULL Suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   33065 WE_PID,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              NULL middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   8450527 WE_PID_LINK,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              'A' middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   373453429 WE_PID_LINK,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              NULL middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   442303062 WE_PID,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              'S' middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775765 WE_PID,
                              990000878 We_addr_id,
                              'BILL' last_name,
                              'RAY' first_name,
                              'M' middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775766 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              NULL middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775767 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              'MAX' middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775768 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              'MICHEL' middle_name,
                              NULL SUffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998776 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              NULL middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998777 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'J' middle_name,
                               'JR' SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998778 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'JAMES' middle_name,
                               'SR' SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998779 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'JACK' middle_name,
                              'JR' SUFFIX
                       FROM   DUAL)
SELECT   *
  FROM   merge_names
  o/p Required
WE_PID    WE_ADDR_ID        FIRST_NAME    LAST_NAME    MIDDLE_NAME    SUFFIX      MERGE_WEPID
1000            999898989       DONALD    BOATRIGHT    L                          1000
1001            999898989       DONALD    BOATRIGHT    LARRY                      1000
1002            999898989       DONALD    BOATRIGHT                               1000
33065           99000000        LUNA        JOSE                                  33065
8450527         99000000        LUNA        JOSE       A                          8450527
373453429       99000000        LUNA        JOSE                                  33065
442303062       99000000        LUNA        JOSE       S                          442303062
30088775765     990000878       BILL        RAY        M                          30088775765
30088775766     990000878       RAY         BILL                                  30088775766
30088775767     990000878       RAY         BILL       MAX                        30088775767
30088775768     990000878       RAY         BILL       MICHEL                     30088775768
399998776       9901111         ELLISON     LAWRANCE                              399998776
399998777       9901111         ELLISON     LAWRANCE    J        JR               399998777 
399998778       9901111         ELLISON     LAWRANCE    JAMES    SR               399998778
399998779       9901111         ELLISON     LAWRANCE    JACK     JR               399998777Thanks

Missing information on how you identify same person.
I'm going with an assumption that same person is identified by first_name,last_name,middle_name and suffix.
WITH merge_names AS (SELECT   1000 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              'L' middle_name,
                              NULL Suffix FROM DUAL
                              UNION ALL
                              SELECT   1001 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              'LARRY' middle_name,
                              NULL Suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   1002 We_pid,
                              999898989 We_addr_id,
                              'DONALD' first_name,
                              'BOATRIGHT' last_name,
                              NULL middle_name,
                              NULL Suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   33065 WE_PID,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              NULL middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   8450527 WE_PID_LINK,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              'A' middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   373453429 WE_PID_LINK,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              NULL middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   442303062 WE_PID,
                              99000000 We_addr_id,
                              'LUNA' First_name,
                              'JOSE' last_name,
                              'S' middle_name,
                              NULL suffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775765 WE_PID,
                              990000878 We_addr_id,
                              'BILL' last_name,
                              'RAY' first_name,
                              'M' middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775766 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              NULL middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775767 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              'MAX' middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   30088775768 WE_PID,
                              990000878 We_addr_id,
                              'RAY' first_name,
                              'BILL' last_name,
                              'MICHEL' middle_name,
                              NULL SUffix
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998776 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              NULL middle_name,
                              NULL SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998777 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'J' middle_name,
                               'JR' SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998778 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'JAMES' middle_name,
                               'SR' SUFFIX
                       FROM   DUAL
                     UNION ALL
                     SELECT   399998779 WE_PID,
                              9901111 We_addr_id,
                              'ELLISON' first_name,
                              'LAWRANCE' last_name,
                              'JACK' middle_name,
                              'JR' SUFFIX
                       FROM   DUAL)
SELECT  we_pid,we_addr_id ,first_name,last_name,middle_name,suffix,min(we_pid) over (partition by first_name,last_name,middle_name,suffix) merge_wepid
  FROM   merge_names m

Similar Messages

  • Please help me to solve the issue in my query.

    Hi All,
    Please help me to understand the mistake what i did in below query and help to resolve that.
    Actually i am trying to create a query to filter the records from db based on my input parameter.
       If my input parameter is 1(@showallrecords) then i need to show all the records which has the IsLatest as 1
       If my input parameter is 0(@showallrecords) then i need to show all the records which has the IsLatest as 0
    select * from tabel1 INNER JOIN tabel2    
    ON tabel1.KeyId = tabel2.KeyId 
    and (@showallrecords = 1 and tabel1.IsLatest = 1 )
    and (@showallrecords = 0 and tabel1.IsLatest = 0 )
    when i am executing the above query with the parameter @showallrecords = 1 ,db is returning 0 rows.If i am executing the above query after removed the last line and (@showallrecords = 0 and tabel1.IsLatest = 0 ) then records are coming.
    i understand that 1=0(last line) and the condition is not true.So its affecting the result.
    Please help me to solve this.

    select * from tabel1 INNER JOIN tabel2
    ON tabel1.KeyId = tabel2.KeyId
    WHERE (tabel1.IsLatest = @showallrecords Or @showallrecords=0)

  • I installed windows 7 on my macbook pro. all is working but lan adaptor and sound od laptop is not working. please help me or send the link where i can download the these drivers.

    I installed windows 7 on my macbook pro. all is working but lan adaptor and sound od laptop is not working. please help me or send the link where i can download the these drivers.I have lost my resource cd .

    If you are running Lion or Mountain Lion, the drivers are downloaded from within Bootcamp Assistant. If you are running Snow Leopard the drivers are on your Snow Leopard install disk.
    Read the Bootcamp Install Guide for your version of OSx. http://www.apple.com/support/bootcamp/
    Bootcamp questions should be asked in the Bootcamp forum where the Bootcamp gurus hang out https://discussions.apple.com/community/windows_software/boot_camp

  • PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED"

    HAI EVERYBODY,
    PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED" during the material master replication by using middleware parameters.
    step1 : i have taken SRM client 810 and named it as CHINNISRM
    step2 : i  have taken r3 client 810 and named it as CHINNIR3
    step3: During material master replication i maintained tables like crmconsum,crmrfcpar,crmparoltp in   r3   and smofparsfa in srm client and filtered the objects and loaded the objects through r3ac3,r3ac1,r3as.
    step4 : And later i have checked in r3 queues to activate the objects,but i have seen a message like  "LOGICAL SYSTEM CHANGED:SEE 588701".according to the oss instructions i have checked in CRMPRLS table in se16 in R3 .there i found out there is one logical client  named with T90CLNT810.
    oss :588701
    Solution
    There are different cases in which different forms of processing are
    required or where several options exist:
    - The logical system name of an R/3 Backend client was changed in
    current operation. In this case, the data hangs in the outbound
    queues of the R/3 Backend system as specified under point 1 of
    the symptom. In this case, the logical system name must be
    changed back to the original value. Then the outbound queues
    can be reactivated. If no data was transferred to the EBP/CRM
    server before the change, also a correctioin of the check table
    is possible.
    - The same logical system name was used again in a new client of
    an R/3 Backend system that was linked to the EBP/CRM server. In
    this case, the data is in the inbound queue of the EBP/CRM
    server with the exception GUID_FOR_LOGSYS_CHANGED. In this
    case, the queue entries which have status SYSFAIL must be rejected, however, not the entire queues. If the new client of  the R/3 Backend system you have linked has exactly the same
    data as the old client and if it is meant to replace the old
    client (that is, this was deactivated), also a correction of
    the check tables is possible. In this case, the inbound queues
    can be reactivated after the correction.
    oss:765018
    1. If the situation in your system corresponds to the situation described
    under "Reason and Prerequisites" and if symptom 1 occurs, you can
    delete the table entry from table CRMPRLS table (there is just one
    entry). Since there is no maintenance dialog for this table and you
    cannot maintain it using transaction SE16, you must use a report to
    delete it. This report is attached to this note as correction
    instructions.
    Create the report ZZ_DELETE_CRMPRLS in your system and copy the source
    code from the correction instructions. You cannot implement this
    source code using transaction SNOTE.
    You can use the report in every plug-in or plug-in basis system, even
    if it is not specified in the validity section.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1.
    2. If the situation in your system corresponds to the situation described
    under "Reason and prerequisite" and if symptom 2 occurs, you can
    delete the entry from table CRMMLSGUID (there is just one entry).
    Since there is no maintenance entry for this table and you cannot
    maintain it using transaction SE16, you must use a report to delete
    it. This report is attached to this note as correction instructions.
    If they do not yet exist, add the following messages to message class SMOF in your logon language:
    Message Message short text
    303 User &1 is not allowed to change table &2.
    304 User &1 IS not allowed to display table &2.
    305 Logical system &1 was not found in table &2.
    306 System error! The current client was not
    found in table T000.
    Create the report ZZ_DELETE_CRMMLSGUID in your system and copy the
    source code from the correction instructions. You cannot implement
    this source code using transaction SNOTE.
    You can use the report for every release of the CRM system, even if it
    is not specified in the validity section. The only exceptions are CRM
    releases with Support Package versions that are too low such as CRM
    Release 3.0 with Support Package 12.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1 of the R/3 back-end system or transaction SMQ2 of
    the CRM system.
    so what should i do to do the replication.please suggest me .untill and unless i solve my problem i cant move to the further activity.i hope you people can solve my problem.thanks in advance.
    thanks and best regards,
    n.chakradhar

    Hi chakradhar,
    Did you find a solution to your issue? We are facing a similar issue and looking to figure out how this can be resolved.
    BR// 420

  • Good day please help me, my iphone 5 wont turn on.  i have tried the hard reset . but that didnt even work. i plugged it in charger but still no response i connect it in itunes still.dont open. please help. i dont have the warranty anymore, i

    good day please help me, my iphone 5 wont turn on.  i have tried the hard reset . but that didnt even work. i plugged it in charger but still no response i connect it in itunes still.dont open. please help. i dont have the warranty anymore, so please help.me.

    Please make a Genius Appointment and take it in for service. By now it probably cannot be fixed, but you never know.

  • HT1918 I would like to change my Visa card from the account but its not changing and the billing information is not changing and I can't purchase any thing from my account its now not usable please help me to solve the problem

    I would like to change my Visa card from the account but its not changing and the billing information is not changing and I can't purchase any thing from my account its now not usable please help me to solve the problem

    You made a purchase and exhausted the credit on your card before it processed. All purchases are final. Contact iTunes Store support. You need to settle up before you can purchase or download anything else.

  • Need driver for canon mg 5250 as scanner is not working with version 10.7. Can you please help me to find the driver so scanner works with WIFI?

    need driver for canon mg 5250 as scanner is not working with version 10.7. Lion. Can you please help me to find the driver so scanner works with WIFI?

    Try with the latest Apple driver package for Canon (released 15th Feb):
    http://support.apple.com/kb/DL899
    This solved my problem with the printing.

  • Please help me ,i forgot the synchronising password for my mac pro lion backup disk

    please help me ,i forgot the synchronising password for my mac pro lion backup disk

    If the backup volume is encrypted, and you forgot the password, then you'll have to erase the volume and start a new backup. There's no way to recover the password.

  • I want to check the main diffrence in Pop up block enabled and disabled.But,i don't get any difference.Would u please help me to understand the difference using one practical example of website

    I want to check the main diffrence in Pop up block enabled and disabled.But,i don't get any difference.Would u please help me to understand the difference using one practical example of website

    Here's two popup test sites.
    http://www.kephyr.com/popupkillertest/test/index.html
    http://www.popuptest.com/

  • Can you please help to understand how the firefox decides on the Expires date for a cached javascript file ( my server did not set any Expire header, but firebox set it down).

    # Question
    Can you please help to understand how the firefox decides on the Expires date for a cached javascript file ( my server did not set any Expire header, but firebox set it down). I tried to understand but different javascript file gets different Expires date value when it is being cached. Please help me as I tried lot and could not get proper answer for this. Thanks in Advance.

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • Please help me in resolving the URL with parameters.

    Hello,
    Please help me in resolving the URL with parameters. If desformat is pdf, a pop up message �Acrobat Reader could not open �pa034922.fdf� because it is either not a supported file type or because the file has been corrupted���.
    if desformat is html or xml, the following URL is working.
    our requirement, report should be in pdf format.
    http://servername:7778/dev60cgi/rwcgi60?server=Rep60_mclaren&&userid=bizsystest/test@business&destype=cache&desformat=pdf&report=salary_dept.rdf&p_dept_list=''ABE','ASE','CE','CHE','CS','DE','DIAL','ECE','ERC','IE','ME','PTE','ARC','ASE1''&p_status_list=''ACP','AD','AP','ATP','D','FE','HD','INS','P','RP','S','TF','TP','TS','ST','GS','O''&p_sex=''M','F''&p_order_by='Name'&p_totals='NO'
    Thanks in advance,
    Usha

    We've seen this bug on machines running IE6 with a certain security patch (I forget its number). There's a thread in the Metalink reports forum about it. It appears to be somewhat tied to another problem where IE runs the report twice (you can see that in Showjobs. You're seeing the problem in 6i; I believe it persists in 9i.
    The workarounds are (1) set Acrobat so it doesn't open within IE or (2) switch to a different browser, like Netscape. For workaround 1, Start Acrobat Reader, Choose File -> Preferences -> General, Uncheck Web Browser Integration
    There's some evidence that it occurs more often with urls that include single quote characters. I think it's worse with XP, but I don't have any proof.
    If you check Adobe's site, you will see this isn't just an Oracle Reports problem. I think we're waiting for Microsoft on this one, so don't hold your breath for a quick fix.
    -- jim

  • HT5622 Please help I've lost the question and answer confidential My Account

    Please help I've lost the question and answer confidential My Account

    Hi Saad al saad,
    If you are having an issue with the Security Questions for your Apple ID, you may find the following articles helpful:
    Apple ID: All about Apple ID security questions
    http://support.apple.com/kb/HT5665
    Apple Support: Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/ht5312
    Regards,
    - Brenden

  • Please help I've lost the question and answer confidential My Account

    Please help I've lost the question and answer confidential My Account

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then the steps half-way down this page should let you reset them : http://support.apple.com/kb/HT5312
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use

  • I have been trying to download the newest itunes to my windows 7 computer wit the last 2 wks now... im at the stage where iv tried everting from uninstalling itunes to installing it again... can someone please help be4 i throw the computer out the window!

    i have been trying to download the newest itunes to my windows 7 computer wit the last 2 wks now... im at the stage where iv tried everting from uninstalling itunes to installing it again... can someone please help before i throw the computer out the window!

    Here is what worked for me:
      My usb hub, being usb2, was too fast. I moved the wire to a usb port directory on my pc. That is a usb1 port which is slow enough to run your snyc.

  • HT5312 I forget answer to my qustion with rescue email adrees please help me and send the answer to my main mail. Thank you very much

    I forget answer to my qustion with rescue email adrees please help me and send the answer to my main mail. Thank you very much

    We are fellow users here on these forums, you're not talking to iTunes Support.
    If you don't have access to your rescue email account, or you don't have one on your iTunes account, then you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps half-way down this page to add/change a rescue email address for potential future use : http://support.apple.com/kb/HT5312

Maybe you are looking for

  • My iOS 4.2.1 cannot upgrade any farther. How can I use TuneIn Radio type of apps which appear to require iOS 4.3 or higher?

    Can I use any Radio apps such as TuneIn or I Heart Radio with iOS 4.2.1. These and other radio apps such as Pandora each state that I must have iOS 4.3 or higher. Apple says my device cannot run any iOS higher than 4.2.1.

  • How to reset Conversion Routine NUMCV in InfoObject

    Dear all, In order to test, I deleted the Conversion Routine NUMCV in tab General of an InfoObject. And now I'd like to reset it as NUMCV. A message says: Conversion Routine NUMCV was deleted. How can I resolve it? Thanks a lot in advance

  • Icon generation at App Startup

    I'm a new Apple Developer doing design work on a few ideas.  My questions are: 1.  Can an App program read a file "external" to itself (not in the App program itself) and change the number of icons painted on the screen at startup?  And if so, can th

  • Image back round removal

    Dear Friends, I have few green colour citrus fruits images  taken over the conveyor belt which is of blue colour. Now i need to extract the friut image with original colour and the back round blue conveyor belt has to be removed. I tried a lot but i

  • Motion 3 Won't Open After Installing

    Hi, I reinstalled Motion 3 after doing it 2 days ago because the beach ball keeps coming up and never leaves causing me to force quit. I let it stay up one night and when i awoke 8 hours later it was still up. thus, i reinstalled after trashing it. t