Merge... When matched... Request... Please help...!

Hello friends - with the following details, can help me write a MERGE request, when Matched updated ArtsDate and not equal insert new rwo in THIS table.

PT: Parameter table
MSO
1
2
5
6

FO table
MSO EngModel
1 RM713
2 TT344
3 TT189
4 TT349
5 RM735
6 TT119
7 RM734
8 RM710

Table SCH
MsO SchDate SchSlot
1 10/18/1 / 2012
2-3/16 / 4 / 2012
3 12/13/7 / 2011
4 12/14/4 / 2011
5 12/15/2 / 2011
6 12/19/5 / 2011
7 12/20/8 / 2011
3/8 12/5/2011

SD SafetyDays
EngModel SDays
RM710 4
RM713 9
RM734 4
RM735 4
TT344 7
TT119 8
TT189 16
TT349 16

WHAT: Table, which must be updated
MSO ARTSDate SchDate SchSlot
2012 3/16 / 2 9/30/2012 4
4 26/4 / 2012 12/14/2011 4
5 10/15/2012 12/15/2011 2
7 2 2 2012 12/20/2011 8

WHAT: Result (updated table) remarks
MSO ARTSDate SCHdaTE SchSlot
2 3/23 / 3/16/2012 2012, 4 matched
4 12/30/2011 12/14/2011 4
5 12/19/2011 12/15/2011 2 matched
7 12/24/2011 12/20/2011 8
10/1/27/2012 10/18/2012 1 unmatched
6 12/27/2011 12/19/2011 5 without matching

Notes on updating THIS table from the table above:
Match PT. MSO with THIS. MSO
When matched (for example, MSO # 2 & 5), ARTS of the update by the following text:
1. take SchDate for MSO even table SCH
2. Add the SD. Table Sdays SafetyDays that makes reference to the same EngModel in FO Table for ASM even in the table of the CHS

When not matched (e.g. MSO # 1 and 6), insert the new line in THIS table
VALUES:
ANN. MSO
ARTS (use the same formula as above)
ANN. CHS
ANN. SchSlot



Thanks for your help...
Sunil

Published by: 865144 on June 10, 2011 12:38

Published by: 865144 on June 10, 2011 12:49

Hello

Yes, it was a typo.
CBC is the alias that I gave to the subquery USING and tgt is the alias to give to the main table of THIS.

MERGE INTO ce tgt
 USING (SELECT t1.MSO,
               t2.SCHdaTE + t4.Sdays ARTSDate,
               t2.SCHdaTE,
               t2.SchSlot
          FROM mso t1,
               SCH t2,
               fo t3,
               SD t4
         WHERE t1.mso = t2.mso
           AND t2.mso = t3.mso
           AND t3.EndModel = t4.EndModel) src
    ON (tgt.mso = src.mso)
WHEN MATCHED
THEN
   UPDATE SET ARTSDate = src.ARTSDate,
              SCHdaTE = src.SCHdaTE,
              SchSlot = src.SchSlot
WHEN NOT MATCHED
THEN
   INSERT VALUES (src.MSO,
                  src.ARTSDate,
                  src.SCHdaTE,
                  src.SchSlot);

G.

Published by: Ganesh aboumagahrif on June 10, 2011 17:06

After that Peter has stressed the alias added.

Tags: Database

Similar Questions

  • Package monthly Adobe had expired. Payment was made 2 days ago not able to merge documents, etc. Please help?

    Package monthly Adobe had expired. Payment was made 2 days ago not able to merge documents, etc. Please help?

    Please contact support:

    https://helpx.Adobe.com/contact.html?step=Acro-APRO-apap-APCC-CPDF-ECHP-document-cloud_mem ute-account-payment_stillNeedHelp

    I hope this helps.

    Concerning

    Megha Rawat

  • Dreamweaver cs3 - CSS not made when opening pages - please help!

    I use Dreamweaver CS3 and have built a certain (low) sites previously so not a perfect beginner, but am totally thrown by my CSS does render does not correctly in a new site I am building.

    I've implemented a new model, all work very well, full CSS included, noticed in the browser ok.

    Then created 2 new pages from this model "Aug.html" and "Oct.html" and recorded the two - both pages contain a link to the other and both preview in the browser on their own.

    However when I click on the link on the page is, not moving no matter what page I start with, the result is the same, the new page that opens seems to forget half of the CSS, div completely and links are back to blue and underlined, everything is changed as if there is no CSS at all.

    Why does the CSS work here? I've never had this problem before, the CSS is simple, I have about 6 div contains everything, including a #wrapper. the body tags and one: links preview all fine until I click and the new page that opens loses its CSS. There is no accessibility / compatibility or upcoming issues.

    Please help - have tried a lot of different things, now I'm completely lost! I know it must be simple, but I really can't find a reason why, really need help with this.

    Thank you...

    However when I click on the link on the page is, not moving no matter what page I start with, the result is the same, the new page that opens seems to forget half of the CSS, div completely and links are back to blue and underlined, everything is changed as if there is no CSS at all.

    You need to refer to what happens when you PREVIEW a page in DW, is - that correct?  In other words, get you an overview of the page, click on the link to page B and page B will appear without the CSS - correct?  Here's why-

    Your link to the style sheet is a link to the ROOT (see the first "/"?).  When loading the B page after clicking on the link in the first page, it tells the browser to find the style sheet to "C:/2012LG_CSS.css" because the browser has NO idea where the root of the site DW is and assumes that the root in the link refers to the root of the hard drive.  Normally, you would not use relative links root, unless there is a good reason to do so-in your case, I am sure that you do not have.  Edit this link to a document a relative, i.e.

    and things work much better.

    In General, it is not a good idea to click outside any page viewed when using DW.

  • I have a TX2000 and the screen goes black when starting up - please help

    Purchased 2008 HP TX2000 Windows Vista 32 bit 2 GB memory

    Laptop trying to load Windows but fails when the lines are moving on the screen - the screen is black or with lines across and the computer is frozen

    We put an adapter on the hard drive, it is difficult to see just looks like it's all a part, you should be able to just pull the part plastic on the pins and that will let you plug your new case, I've experienced the same thing about 3 years ago, it really seems that it's just one piece... It should first come fairly easily, simply pull... Please let me know if it works for you

    Here's a photo I hope this can help, if it please click on accepted solution or glory, but only if I helped.

  • URGENT: First CC 2015: flickr strange question in my calendar - worsens when I render - Please HELP

    Hey guys,.

    I have this horrible problem in my calendar. See attachment. any idea what's going on? I have a bunch of pictures with scale and opacity of the simple effects... that's a big presentation at the corner. Help, please!

    It looks like this, whenever I reached the break. When I hit play, it seems.

    the last time I visited, it aggravates the problem, and the sequence was blinking like that horrible then he was playing.

    Screen Shot 2016-02-14 at 5.13.53 PM.png

    Thank you

    I updated my computer for the el capitan later and it fixed it

    something wrong with the GPU/OpenGL etc... but now it is fixed!

  • Changes color when exporting! Please help ASAP, need sorted pronto!

    I'll cut to the Chase... In particular (I say this because I think that is happening in the other color settings, just no where near as obvious) when I turn into a black and white photo of actually changing the toggle (not just by pulling on the saturation) it will straight not black and white, it's more than a sepia color. Yet when I export the same picture, it's clearly evident crisp black and white! I change all the settings, I tried to change the export of color formats, but this just happened randomly one day, I don't remember fiddling with anything! Help, please! Thank you!!!

    Can you please select the profile as sRGB IEC61966 - 2.1

  • Password required now vs often only required When Boot Up - please help

    I live alone, so I'm the only user on my PC with Windows 7 Pro 64 bit. I have a password that I never had to use, after a reboot. Now, if I'm away from my office for several minutes, I have to enter my password to get back in. I can't change anything. In fact, I would like to give up never use a password, if possible. Can someone help me to simplify access to my PC? Thank you!!

    It may be a power option or a choice of screen saver perhaps.

    Power option - http://www.thewindowsclub.com/disable-login-sleep-windows-7-8

    screen saver - http://windows.microsoft.com/en-us/windows/windows-password-for-screensaver-password#1TC=windows-7

    Just read the articles above and check the grace.

  • Cannot return number of orders by the hour in the request please help

    Here's the query I run currently. It allows you to select the Date and time on a form and returns a total number of commands between the Date and the selected hours. What I need to break further down, at the time, the number of orders. So it should take the 05:00 06/08/2012-06/08/2012 11:00 show me the number of orders at the time. Where currently it totals orders for the chosen duration

    This query currently works but does not divide it by time unless I select the 05:00 06/08/2012-06/08/2012 06:00 and then repeat for each hour. Which is very time consuming.

    Any help would be amazing as I have been at it for weeks.

    SELECT
    ENTITIES OF ROUND (SUM (COUNTWEIGHT)), AREA OF Z.NAME
    Of
    PPSDBA. ARCH_RX RX,
    PPSDBA. ARCH_VIAL_CONTENTS STROKE,
    PPSDBA. ZONE Z,
    (SELECT 1 / COUNT (RX.) TOTE_ORDER_ID COUNTWEIGHT), RX. TOTE_ORDER_ID ORDER NO.
    OF PPSDBA. ARCH_RX RX,
    PPSDBA. ARCH_VIAL_CONTENTS STROKE,
    PPSDBA. ARCH_VIAL AV
    WHERE AV RX_ID = RX. RX_ID AND
    STROKE. VIAL_ID = BC VIAL_ID AND
    RX. FILLED_TYPE NOT IN (19.20) and
    STROKE. FILL_DATE BETWEEN TO_DATE('#DATE_FROM#', 'MM/DD/YYYY hh24:mi') AND TO_DATE (' #DATE_TO # "," MM/DD/YYYY HH24 ')
    RX GROUP. SUBQUERY TOTE_ORDER_ID),
    PPSDBA. ARCH_VIAL AV
    WHERE
    SUBQUERY. ORDERID = RX. TOTE_ORDER_ID AND
    AV. RX_ID = RX. RX_ID AND
    RX. FILLED_TYPE = Z.ZONE_ID AND
    STROKE. VIAL_ID = BC VIAL_ID AND
    RX. FILLED_TYPE NOT IN (19.20) and
    STROKE. FILL_DATE BETWEEN TO_DATE('#DATE_FROM#', 'MM/DD/YYYY hh24:mi') AND TO_DATE (' #DATE_TO # "," MM/DD/YYYY HH24 ')
    Z.NAME GROUP

    This will probably work. I can't test it because I don't have the tables:

    SELECT
    TRUNC (STROKE. FILL_DATE, 'HH') FILL_DATE_HOUR,.
    ENTITIES OF ROUND (SUM (COUNTWEIGHT)), AREA OF Z.NAME
    Of
    PPSDBA. ARCH_RX RX,
    PPSDBA. ARCH_VIAL_CONTENTS STROKE,
    PPSDBA. ZONE Z,
    (SELECT 1 / COUNT (RX.) TOTE_ORDER_ID COUNTWEIGHT), RX. TOTE_ORDER_ID ORDER NO.
    OF PPSDBA. ARCH_RX RX,
    PPSDBA. ARCH_VIAL_CONTENTS STROKE,
    PPSDBA. ARCH_VIAL AV
    WHERE AV RX_ID = RX. RX_ID AND
    STROKE. VIAL_ID = BC VIAL_ID AND
    RX. FILLED_TYPE NOT IN (19.20) and
    STROKE. FILL_DATE BETWEEN TO_DATE('#DATE_FROM#', 'MM/DD/YYYY hh24:mi') AND TO_DATE (' #DATE_TO # "," MM/DD/YYYY HH24 ')
    RX GROUP. SUBQUERY TOTE_ORDER_ID),
    PPSDBA. ARCH_VIAL AV
    WHERE
    SUBQUERY. ORDERID = RX. TOTE_ORDER_ID AND
    AV. RX_ID = RX. RX_ID AND
    RX. FILLED_TYPE = Z.ZONE_ID AND
    STROKE. VIAL_ID = BC VIAL_ID AND
    RX. FILLED_TYPE NOT IN (19.20) and
    STROKE. FILL_DATE BETWEEN TO_DATE('#DATE_FROM#', 'MM/DD/YYYY hh24:mi') AND TO_DATE (' #DATE_TO # "," MM/DD/YYYY HH24 ')
    Z.NAME GROUP, , TRUNC (STROKE. FILL_DATE, 'HH')

  • Get several lines with the request - please help

    Hello

    I have query that gives me the output below.
    select distinct a.*,cu1.usr_key,cu1.first_nm,cu1.last_nm
    from(
          select ng.grp_key, ng.grp_nm , gt.grp_typ_nm, stts.nm as grp_sts, ng.expiry_date, ng.updt_dttm, stts.stts_key
          from new_group ng, user_group ug, group_type gt, status stts
          where ug.grp_key = ng.grp_key and ng.grp_typ_key = gt.grp_typ_key and 
          ng.stts_key = stts.stts_key and
          ug.usr_grp_rl_typ_key = 1 and 
          lower(ng.grp_nm) like 'test foe%'
          union 
          select ng.grp_key, ng.grp_nm , gt.grp_typ_nm, sts.nm as grp_sts, ng.expiry_date, ng.updt_dttm, sts.stts_key
          from new_group ng, group_type gt, status sts
          where ng.grp_typ_key = gt.grp_typ_key and ng.stts_key = sts.stts_key and 
          lower(ng.grp_nm) like 'test foe%')a, common_user cu1, user_group ug1
    where cu1.stts_key = a.stts_key and cu1.usr_key = ug1.usr_key and ug1.usr_grp_rl_typ_key = 1 and ug1.grp_key(+) = a.grp_key;
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 09.38.34 29742 Sam Saed
    18345 enemy test remove Group organization DELETED 9 February 12 09.38.34 AM 3 29643 dummyName514 dummy
    18345 enemy test remove Group organization DELETED February 9, 12 09.38.34 AM 3 28917 TestMObileUser Gujral
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 27284 Rocky jegou 09.38.34
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 28920 Bhavani Gujral 09.38.34
    18345 enemy test remove Group organization DELETED 9 February 12 09.38.34 AM 3 29645 dummyFName516 dummy
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 27316 Karthik Gilani 09.38.34
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 28147 Bowl David Mathews 09.38.34
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 09.38.34 29731 Sam Saed
    18345 enemy test remove Group organization DELETED February 9, 12 AM 3 28919 Madhu mango 09.38.34

    For a group 18345, there are 10 users and this is the reason why I get a multiple user records.

    I can't avoid these last three columns, because I have to show these values in the application.

    In my opinion, the UNION is at the origin of the problem. Can I replace the UNION here? Please share your ideas on this.

    Thank you
    Rambeau

    Published by: ouali on February 9, 2012 22:35

    Hello

    because I have to show these values in the application.

    What is your problem then? If you simply issue a SELECT statement to application code or send the data back to REF CURSOR, it will be quite OK to have several lines. That's what the SELECT statements are for: to return sets of results with several lines.
    So, could not explain your problem more in detail please? If you get an error somewhere, provide the code causing the error and the error message (it is probably ORA-001422 exact extraction returns several lines somewhere in PL: / SQL, isn't it? then post here).

    In my opinion, the UNION is at the origin of the problem. Can I replace the UNION here? Please share your ideas on this.

    Us don't know not the answer to this question, because no one here knows your needs (what you need).

  • I have 2 accounts of adobe Setup and want to merge to 1. My Behance site is a different connection/e-mail than my creative cloud. So... When I'm connected to CC, I can't see my Behance site and updated. Can you please help?

    I have 2 accounts of adobe Setup and want to merge to 1. My Behance site is a different connection/e-mail than my creative cloud. So... When I'm connected to CC, I can't see my Behance site and updated. Can you please help?

    Please contact our support staff from the following link for assistance on this subject: https://helpx.adobe.com/contact.html

    (be sure to connect to adobe.com with your Adobe ID first)

  • I bought membership CC photography... but still my request as downloaded as a trial... and advising me to buy... When I click to buy it tell you already bought... Please help do not know what to do

    I bought the membership CC photography... but still my application at first instance... and advising me to buy... When I click to buy it tell you already bought... Please help do not know what to do

    Lightroom trial has expried so I can't use it anymore and photoshop is downloaded as a trial for 30 days

    Hi Ali,

    Please see this document to activate it:

    https://helpx.Adobe.com/creative-cloud/help/sign-in-out-activate-apps.html

    Double post.

    Let us know if that helps.

    Concerning

    Megah Rawat

  • How to extend my C drive volume in Windows 7, so that the disc I want to merge in drive C is not adjacent to the C drive, please help

    How to extend my C drive volume in Windows 7, so that the disc I want to merge in drive C is not adjacent to the C drive, please help

    Jackin salvation,

    Welcome to the Microsoft Answers community.

    When resizing of volumes in Windows7, you must be aware of the following criteria:

    • Only you have the possibility to reduce or enlarge NTFS or RAW (unformatted) partition using Windows 7 tools.
    • When you shrink a partition, files not movable as a page file or a shadow storage area are not resettled. This is why you cannot reduce the size of the Windows beyond volume where these types of files. If you need to reduce the volume, you will need to remove, move or delete the page file or the shadow first storage area, and then reduce the volume and then add the page file or shadow storage on the disk area.
    • If enough bad clusters are found on the disk partition will not shrink.
    • You must be logged on to an administrator account in order to resize Windows Volumes in windows 7.

     

    Windows 7 Partitions or Volumes of shrinkage

    This section shows must shrink a Windows volume or partition. To do this, we must open the Windows 7 disk management tool. The following steps will guide you in this process.

    1. Click the button on the Start Menu in the bottom left of your desktop , and then click the Control Panel menu option.

    2. When Control Panel opens, click on system and Maintenance category.

    3. When opens in system and Maintenance category, scroll down and click on Administrative Tools.

    4. Double-click the computer management icon. The console of the computer management will now open. Down, you will see a category called storage and under this category will be the disk management icon, as shown below.

    5. Click on the disk management icon, and you will now be in the disk management utility as shown in the figure below. This utility you can see all the partitions on your computer and format, delete, create, develop or resize them. For this tutorial, I'm going to resize the partition E: of 16 GB so that when completed, there is a 8 GB partition and provides another 8 GB of free space I can use for other purposes.

    6. To shrink the partition, just click with the right button on the partition that you want to work with and select reduce . In this example, I click right on the E: partition and in the menu that appears, I select shrink.

    7. A screen similar to the one below appears. This screen indicates the size of the current partition you, how you can reduce it to a field where you can enter a specific amount to reduce, and then how big partition will be once it shrinks. By windows 7 default enters the maximum amount that you can reduce the volume, but if you want to change this amount, do so by entering the amount in MB in the enter the amount of space to shrink in MB: field. When you are satisfied with how windows 7 will shrink the partition, click the minimize button.

    8. Once windows 7 is complete decreases the volume, you will be in the disk management screen, but now the partition size will be the size you requested as shown below.

    Now that you have reduced the size of your volume of Windows, you can close the computer management console.

    You have now finished reducing your score and you have the extra space available for use as required.

    Windows 7 Partitions or Volumes extension

    This section shows that you must extend a Windows volume. To do this, we must open the tool of disk management where we can resize our volumes. The following steps will guide you in this process.

    1. Click the button on the Start Menu in the bottom left of your desktop, and then click the Control Panel menu option.

    2. When Control Panel opens, click on system and Maintenance category.

    3. When opens in system and Maintenance category, scroll down and click on Administrative Tools.

    4. Double-click the computer management icon. The computer management console will now open. Down, you will see a category called storage and under this category will be the disk management icon, as shown below.

    5. Click on the disk management icon, and you will now be in the disk management utility as shown in the figure below. This utility you can see all the partitions on your computer and format, delete, create, develop or resize them. For this tutorial, I'll extend the E: partition so that it uses the rest of the available space on the disc 1.

       
    6. To extend the partition, he just click right-click on the partition that you want to work with, and then select the Extend option. In this example, I click right on the E: partition and in the menu that appears, select Extend.

    7. A wizard appears as shown below. Press the Next button to continue.

    8. A new screen, shown below, is displayed allowing you to select the free space available on your local hard disks that you can use to extend the space of the selected partition. It is important to note that Windows 7 allows you to extend a volume using free space on the same drive as well as the other disks. I strongly suggest that you do not extend a volume on a disk with free space of the other. It is because if one of the disks has a hardware failure, then all data on this volume will be removed. Rather just to use the free space on a drive that contains the volume you extend
      .

      As discussed in step 5, for this tutorial we are going to extend my 8 GB partition (drive E :) to the total size of disk 1 using all the available space. As disk 1 is only available free space on my computer, windows 7 automatically select as shown in the image above and use the maximum amount available to extend the partition. If there were other drives with free space that they have shown during the selection available . If you want to extend the volume to a lower amount you can change in the Select the amount of space in MB: field. In the contrary case, press us the button Next .

    9. You will be now be presented with a confirmation screen. If you are sure you want to extend the volume, press the Finish button. Otherwise, press the back button to make changes or the Cancel button to cancel this operation.

    10. Once Windows 7 completed to extend the volume, you will be on the screen disk management, where you can see the amount that you have extended with the new size. An example of this is shown below.

    At this point, you can close the Management window of the computer that your task is completed.

    Hope this information is useful.

    Let me know if it worked.

    Thank you, and in what concerns:

    Umesh P - Microsoft Support

    Visit our http://social.answers.microsoft.com/Forums/en-US/answersfeedback/threads/ Microsoft answers feedback Forum and let us know what you think.

  • Please, help me to by merging the same id assining people

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit 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               399998777
    Thank you

    Hello

    Interesting problem!

    That's what you asked for:

    WITH    got_min_we_pid  AS
    (
         SELECT     merge_names.*
         ,     MIN (we_pid) OVER ( PARTITION BY  first_name
                                     ,                  last_name
                            ,            middle_name
                            ,            suffix
                            )     AS min_we_pid
         FROM    merge_names
    )
    ,     possible_matches       AS
    (
         SELECT     CONNECT_BY_ROOT min_we_pid     AS min_we_pid
         ,     we_pid                    AS leaf_we_pid
         FROM     got_min_we_pid
         WHERE     CONNECT_BY_ISLEAF  = 1
         START WITH   we_pid                = min_we_pid
         CONNECT BY   first_name             = PRIOR first_name
              AND  last_name                = PRIOR last_name
              AND  SUBSTR ( 'x' || middle_name
                       , 1
                       , LENGTH ('x' || PRIOR middle_name)
                       )                   = 'x' || PRIOR middle_name
              AND  'x' || middle_name    > 'x' || PRIOR middle_name
              AND  'x' || suffix        = 'x' || PRIOR suffix
    )
    ,     got_match_cnt     AS
    (
         SELECT DISTINCT
              min_we_pid
         ,     leaf_we_pid
         ,     COUNT (DISTINCT leaf_we_pid) OVER (PARTITION BY  min_we_pid)     AS match_cnt
         FROM     possible_matches
    )
    SELECT       c.*
    ,       NVL (p.leaf_we_pid, c.min_we_pid)     AS merge_wepid
    FROM              GOT_MIN_we_pid  c
    LEFT OUTER JOIN      got_match_cnt   p   ON  p.min_we_pid     = c.min_we_pid
                                      AND p.match_cnt     = 1
    ORDER BY  c.last_name
    ,            c.first_name
    ,       c.middle_name
    ;
    

    Here's how it works:
    First of all, we take care of the exact replica, by finding the we_pid lowest for each group defined by (first_name, last_name, middle_name, suffix). For example, the two lines for Jose Luna (no middle name) are assigned to the min_we_pid = 33065. It is this min_we_pid, not the original we_pid, that is used in all future operations.
    Then we are all names other names that are similar, but more comprehensive, using a CONNECT BY (subquery possible_matches) query. The parents in this query are stored with short middle_names, and children are lines that have first_name, last_name identical and suffix, but middle_names longer. I concatenated the x at the beginning of all middle_names for comparisons, to treat the NULL as being less at, but similar to something else. Is so, that we had a group of lines with identical names (and suffixes) with the exception of the middle_names, then
    NULL middle_name might be a parent got ', "DEB" and "DEBORAH",.
    A ' would be a parent of "DEB" and "DEBORAH", and
    "DEB" would be a parent of 'DEBORAH '.
    By following this chart until we find the lines that have no children, we may associate each short middle_name with the similar longer middle_name, or names. At this point, we will have "BILL RAY" as the ancestor of 'RAY MAX BILL' as well as "RAY MICHEL BILL". Here comes the following subquery, got_match_cnt. If notes how many descendants are associated with each ancesotor, in other words, how much longer names might match a name more runs. If this number is greater than 1, we do not consider one of the matches. That is why match_cnt = 1 is one of the join conditions in the main query, where each row in the theoriginale table is related to its more relative, when it exists, and if it is unique.

  • Please HELP: How do I find and edit a D7000 Nikon RAW files in Photoshop CS? (I downloaded Adobe DNG Converter 9.0, but when I try to download a file no picture and it says gray: "no item corresponding to your search.")

    Please HELP: How to view and edit RAW files from a Nikon D7000 in Photoshop CS?

    I downloaded Adobe DNG Converter 9.0, but when I try to download a file no picture and it says gray: "no items match your search."

    I'm in tight (like most designers), so any solution ASAP would be great. And Yes, I know that my Photoshop is old. Nothing I can really do about it at the moment. Thanks in advance!

    In Photoshop, select help > about plug-in > Camera Raw.

    If it is 2.3 or less, you need to update Camera Raw 2.4, which you can download here:

    Adobe - Photoshop: for Windows: Camera Raw 2.4 update

    Adobe - Photoshop: for Macintosh: Camera Raw 2.4 update

  • Please help me, last night I partition my macbook pro, el capitan, and when I try to open my windows via bootcamp I can't access most, blue screen out and my laptop closed.

    Please help me, last night I partition my macbook pro, el capitan, and when I try to open my windows via bootcamp I can't access most, blue screen out and my laptop closed.

    How do you partition the disk?

    This is what app or OS that do you?

Maybe you are looking for