Link Person Based on address or company name

Version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
I have the Following Scenario where i am trying to link Person based on Addr_id / Addr_id_comp/ Org_id.
I want to create a flag as 1 which tells me that they are linked. Right now with the below Example The flag Returns as 0.
WITH Link_address_t AS (SELECT   6439 Person_id,
                                77131101 we_Addr_id,
                                183818078 we_addr_id_comp,
                                9287841 we_org_id
                         FROM   DUAL
                       UNION ALL
                       SELECT   6439 Person_id,
                                393426140 we_Addr_id,
                                394052621 we_addr_id_comp,
                                918388 we_org_id
                         FROM   DUAL
                       UNION ALL
                       SELECT   6439 Person_id,
                                77131101 we_Addr_id,
                                394052621 we_addr_id_comp,
                                918388 we_org_id
                         FROM   DUAL)
    SELECT   Person_id,
             we_addr_id,
             we_addr_id_comp,
             we_org_id,
             CASE
                WHEN (   we_addr_id = PRIOR we_addr_id
                      OR we_addr_id_comp = PRIOR we_addr_id_comp
                      OR we_org_id = PRIOR we_org_id)
                THEN
                   1
                ELSE
                   0
             END
                FLag
      FROM   Link_address_t
START WITH   Person_id = 6439
CONNECT BY   NOCYCLE Person_id = PRIOR Person_id
Output Required
PERSON_ID    WE_ADDR_ID    WE_ADDR_ID_COMP    WE_ORG_ID    FLAG
6439    77131101    183818078    9287841    1
6439    393426140    394052621    918388    1
6439    77131101    394052621    918388      1

I don't see why you're using a hierarchical query here. This seems to do what you want (note, I've added a primary key column to your original table):
WITH Link_address_t AS (SELECT  1 pk,
                                6439 Person_id,
                                77131101 we_Addr_id,
                                183818078 we_addr_id_comp,
                                9287841 we_org_id
                         FROM   DUAL
                       UNION ALL
                       SELECT   2 pk,
                                6439 Person_id,
                                393426140 we_Addr_id,
                                394052621 we_addr_id_comp,
                                918388 we_org_id
                         FROM   DUAL
                       UNION ALL
                       SELECT   3 pk,
                                6439 Person_id,
                                77131101 we_Addr_id,
                                394052621 we_addr_id_comp,
                                918388 we_org_id
                         FROM   DUAL)
    SELECT   Person_id,
             we_addr_id,
             we_addr_id_comp,
             we_org_id,
             CASE
                WHEN EXISTS (SELECT 99
                             FROM   link_address_t la2
                             WHERE  la2.person_id = la.person_id
                             AND    la2.pk != la.pk
                             AND   (la2.we_Addr_id = la.we_addr_id
                                 OR la2.we_Addr_id_comp = la.we_addr_id_comp
                                 OR la2.we_org_id = la.we_org_id)) THEN 1
                ELSE 0
             END Flag
      FROM   Link_address_t la
     WHERE   Person_id = 6439

Similar Messages

  • Search ("filter") addresses by company name

    I regret the possibility of searching a contact by company name (with Nokia Ovi Suite 3.0.0.290) is not available. Can I hope this feature (or a full text search) will be added in near future? Is there a better place to post a proposal than here?

    I basically agree the E90 "features" can make you angry at times.
    Like when you download an lmx GPS position file or open one from the phone and try to navigate but when using the lmx file the landmarks stored in the phone is not available.
    Stupid things like that.
    But with the barcode reader Nokia forgot to tell you it is not intended for ordinary one-line barcodes, but for 2D codes. And the use of 2D barcodes is unlimited.
    2D barcodes can be put on business cards, websites, posters, T-shirts, labels, wall posts and much more.
    Once you have the barcode in front of you, you can scan it with your mobile and obtain a text string.
    The neat thing is if the text string is an URL the phone can download any web content as long as it understands the MIME type of data sent.
    MIME type is supplied in the message HTTP header. (For most file types the web server supplies the correct MIME type. For Nokia landmark *.lmx it has to be added to the server config or sending web application)
    It means your business card could have a 2D barcode with an URL leading to a vcard file on a web server where the phone fetches it and asks if you want to save it in your contact book of the phone.
    You can use 2D-barcodes for downloading landmark *.lmx files from a web site by just pointng your camera to the web page and off you go to your destination using the built in GPS.
    You can read more and create your own codes here:
    http://mobilecodes.nokia.com
    Nokia has a server that delivers barcode images if you want to use them on a website.

  • There is another person using my company name.

    We have a very distinct and unique name yet there is another person using that esact comapny name as a personal contact. How do I get this person to stop using my company name? Isnt this a form of identity theft? How do I proceed to take legal action in this case?

    Hi, PhoenixSymphony, and welcome to the Community,
    In the USA, if your company name is trademarked or copyrighted, there are legal remedies which you should discuss with an attorney.  As far as identity theft is concerned, seek counsel with your local law enforcement agency.  Hopefully you reside in a jurisdiction where cybercrime is taken seriously.
    If you wish to contact Skype Customer Service as well, please be neither alarmed nor surprised if you are asked to verify the company name is indeed "yours."  You may be requested to provide documentation, the process of which is explained in this FAQ article:
      https://support.skype.com/en/faq/FA11016/how-do-i-send-proof-of-payment-to-skype-customer-service?
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How do I show more information for result set, I need company name, company address and company phone number to show. Now it is just company name and company address no telephone number, I need the number to show as well in the first result set

    The result set I get for a search now only shows the company name and address, if I want the telephone number of the company in the result set, I have to click on the link to go the site information to get the number. I want the company name, address and phone number to show up in the result set without having to click on each hyperlink to get the telephone number...

    ???
    See my profile at the left for information you are missing.
    Who, when, why, how, how much, what is the URL

  • I "reply"ed to an e-mail message. The next time when I chose to write a new message and type the first letter of the person I replied to earlier, that name and e-mail address appears as a choice included in a pop up list of my contacts.

    I "reply"ed to an e-mail message. The next time when I chose to write a new message and type the first letter of the person I replied to earlier, that name and e-mail address appears as a choice included in a pop up list of my contacts. The persons name is not in my contacts and I would like to delete it from popping up. Do you know how I can do this?

    The Mail app on the iPad/iPhone/iPod Touch does have an option to clear previous recipients. You can learn to live with it.  But if you want to get rid of it, the only way to remove these cached email addresses from the Mail application is restoring the iPhone/iPod Touch as a new phone/iPod.  If you restore from backup, the cache is also restored.
    This article shows you the screens you will see during the restore:  http://support.apple.com/kb/HT1414

  • How to add company name to show up in contact list with person's name on Droid

    I just switched from the Blackberry Storm to the Motorola Droid.  Is there a way to have the company name show up in the contact list under the person's name.  I need that for work.  It syncs up with a program called Act by Sage and my storm used to show both.

    You can edit your contacts, and list the company name under the organization section. However, it will not show up when they call you. You will only be able to see it in your contact list. Hope this helps!

  • How do I sort my address book by company name

    My new iPhone comes tomorrow. I need to sort my address book in iCloud by company name, not last name first name. If I cant do this is there a third party software I can download for an address book that will allow me to do this?
    PS I am currently not using an iPhone and am manually entering addresses.

    Enable the menu in the Address Book. Then look at the options under View and Sort By.
    More here on sorting: http://www.ramsden.org.uk/8_How_to_sort.html
    And about menus here: http://chrisramsden.vfast.co.uk/13_Menus_in_Thunderbird.html

  • Does someone know information about Company name:TianMei Electronic Trade Co., Ltd Address:Anbao Building No.28 street, quanzhou , FUJian, China.Is it Legit to buy there or not? or what information you have???please answer

    Does someone know information about
    Company name:TianMei Electronic Trade Co., Ltd
    Address:Anbao Building No.28 street, quanzhou , FUJian, China
    Pleas abswer is it legit or not?
    Does someone have got any experience with that company?
    Any information is welcome?
    Or is it somekind on cheating ?`?
    Do i get there a legit iphone or somekind of Chinese knock offs?
    <Email Edited By Host>

    You can look for authorized Apple resellers here:
    https://locate.apple.com/cn/zh/
    If you have any doubts about any reseller, I strongly advise that you not purchase from them. Buy your iPhone directly from Apple and you will then have no worries.
    Regards.

  • Issue related to Company name and Ip address

    Dear Experts,
    When a user click the SAP icon the company name is not appearing, shown below
    When user enters the correct userid and password automatically the  system will pop the IP Address screen
    When the user enter the correct Ip address user gets an error saying the user code is and password is invalid
    However the company name appears then user has to login again then SAP Opens.
    Problem is why is not storing the company name once it is opened.and why the error comes everytime the user logins freshly.
    I have tried in Admin login it has come. But other users login its same error, even though the rights have been given to SAP folder in C-drive
    SAP Version is 8.82 PL 7
    Thanks&Regards
    Darshan Desai

    Hi,
    Thanks for the reply, i tried the above method ,but when the user clicks the SAP Icon and
    Run as Administrator then only the Company name will be stored and it doesn't ask the IP Address.
    But when the icon is clicked directly the company name is not stored and the IP address pop up.
    The user can't dially use as Run as Admin, as its an admin login.
    But its happening only in some systems, other system are working even without admin privileges.
    I also have provided full access to the SAP Folder in C-drive where SAP B1 is installed, even then the problem persists.
    Kindly let me know if there is any other folder apart from SAP folder in C-drive of the local system. where full access is to be provided.
    Thanks&Regards
    Darshan Desai

  • SRM 7.0 , Get company name based on company code

    Hello friends,
    Is ther any function module or table to read company name based on company code in SRM 7.0 ?
    Kindly let me know your inputs.
    Thanks.
    Preethi.

    Hi,
    To find purchase group.
    BBP_OM_FIND_PURCH_GRPS_BEI
    To fund purchase org.
    BBP_OM_FIND_PURCH_ORGS_BEI
    To find company.
    BBP_OM_FIND_COMPANIES
    Regards,
    Pedro Marques

  • Dynamic display of the Company Name based on Org

    Hello All,
    I need to dynamically display the Company name based on the Org_id and the ORG is not being populated in the XML data file. How do i achieve this,please let me know.
    Thanks
    Rakesh

    Rakesh,
    It's like getting something from nothing (data template)... If you do not want to modify your report, then Vetri's option will be fine(your going to add not modify)...
    Or,. define a new Oracle report based on the seeded one then do modify...
    regards,
    Rownald

  • I have many contacts in address book from a certain company that just changed its name.  Is there a way to globally change all the contacts to the new company name all at once?

    I have many contacts in address book from a certain company that just changed its name.  Is there a way to globally change all the contacts to the new company name all at once?

    Rando510 wrote:
    Although clunky as you say, this sounds like a reasonably efficient way to accomplish what I was seeking.
    Address Book has no global find/replace. Bob Grove suggested one possible workaround; however, a grep-capable text editor (eg, TextWrangler) is better than TextEdit if complex strings are involved.
    An alternative is Bento (which is designed specifically to interact with the AB database), but it's not free.

  • Can I make a custom signature with my company name, address, phone number, etc. that I can add to the end of my business emails?

    I would like to be able to sign off at the end of company emails that I send, and have the sign off include:
    First and Last Name
    Company Name
    Street Address
    City, State, Zip
    Telephone number
    Email address
    Is there some simple way this can be added at the end of my emails. Other people in the office would have the same information, but use their own name.
    This eliminates having to type this in with each email.

    Hi there,
    If you create a j-peg (using another program such as Photoshop or publisher) of your title page, then you can then drag it in like a photo (you may need to save it to iPhoto first). You can then over lay with other text, use a theme or leave it plain and possible add some transitions. Hope that helps.

  • Can my contacts on my iPhone see my personal information such as my home address and "related names" (relatives)?

    I was setting up my own info in Contacts on my iPhone 5S to keep things organized and tidy. I added in my home addresses (I have two) and added my relatives' names as well. I did this to make things convenient for me, especially when using Maps... I can just type or say "home" or "home2" instead of typing in the entire address or scrolling around and zooming in with my fingers. It's especially handy when I'm driving and don't want to use my hands. I also added in my relatives' names so I can just tell Siri to give me directions to "aunt Debbie" or "call uncle Joe," etc...
    But then I realized this is information that my contacts can probably see. Many of my contacts are only professional acquaintances (not friends) and I don't want them to know my home addresses or the names of my relatives. All I want my contacts to see is my phone number, job title, and the link to my LinkedIn page.
    As far as I know there is no setting to control what info is visible to your contacts. If there is, can someone please point it out to me? If not, is there another solution? Or should I just not have my addresses stored in my phone (which kind of defeats the purpose of the phone being convenient when you need it to)? Any help is appreciated, thanks.
    iPhone 5S
    iOS 8.2

    I hope that's right. With social networking and social integration and now iCloud in the picture, I wonder what gets synced these days between contacts. I have contacts in my iPhone who I have no idea who they are but they automatically synced to my phone simply because I had an email exchange with them once upon a time. And I'll get those same peoples' birthday reminders (as if I care), LinkedIn links, and though I don't use facebook or twitter I'm sure those show up on everybody's contacts who uses them.
    I used to be more tech savvy a few years ago but with more responsibilities as I get older I just don't have the time to study what's what these days. These days it seems like everything is now about the "cloud" and I have no idea what iCloud will sync automatically with other iPhone users. I'm growing increasingly wary about who can see what, and my home addresses and relatives' names are on top of that list.
    Thank you for your reply.

  • Address Book - Unwanted individual's name under Company Name

    Individuals names automatically insert under the Company names at the top of contact pages.
    Can this be stopped?
    I delete them regularly but they keep appearing.
    They are particularly frustrating as they overwrite names being typed into Mail.

    Try pearLabelizer V0.6
    http://www.pearworks.com/pages/software.html
    You can drag address book cards to any label on the sheet. This is great for printing on a label page that you didn't use all the way.
    In the preferences you can set any combo of info from the address card you want. You can save any number of theses combos.
    MacPro 3GHz Dual Xeon/MacBook Pro 2.16   Mac OS X (10.4.8)  

Maybe you are looking for