Having to perform the join

Oracle Version = PL/SQL Release 11.2.0.2.0 - Production

Hi gurus

Need your help and appreciate if some help out me.

I have the following data,

Examples of data

With blt as

(

Select "AD" blt in union double all the

Select "DENTAL" blt in union double all the

Select 'HEALTH' double blt

),

SetCode as

(

Select 'ABC' set_cd, 'AD' union blt double all the

Select 'DEF', 'DENTAL' from dual union all

Select 'TV', 'HEALTH' of the dual union all

Select 'VCR', 'HEALTH' of the dual union all

Select 'HEALTH', 'HEALTH' of the double

)

SELECT SET_CD SETCODE,

BLT B

WHERE A.BLT = B.BLT;

Results of the existing query

set_cd

ABC

DEF

TV

VCR

HEALTH

Required result

ABC

DEF

HEALTH

Rules

In the case of accession, if it has 2 or more than 2 results return then join set_id = blt as I did with health record.

In summary, I need unique single Archives against 1 blt and if more than 1 set_id exists against blt even so that blt and set_id get are the same. Thank you

with blt as)

Select "AD" blt in union double all the

Select "DENTAL" blt in union double all the

Select 'HEALTH' double blt

),

SetCode as)

Select 'ABC' set_cd, 'AD' union blt double all the

Select 'DEF', 'DENTAL' from dual union all

Select 'TV', 'HEALTH' of the dual union all

Select 'VCR', 'HEALTH' of the dual union all

Select 'HEALTH', 'HEALTH' of the double

),

t like)

SELECT COUNT (*) NTC (A.BLT PARTITION),

SET_CD,

A.BLT

OF SETCODE,.

BLT B

WHERE A.BLT = B.BLT

)

SELECT SET_CD

T

WHERE CNT = 1

OR BLT = SET_CD

/

SET_CD
------
ABC
DEF
HEALTH

SQL >

SY.

Tags: Database

Similar Questions

  • Windows 8 pro upgrade from Vista Home premium - abandonment of the facility after having successfully performed the wizard upgrade reboot

    I started the process of upgrading to Windows Vista Edition Family Premium to Windows 8 Pro by using the relevant DVD purchased from amazon.co.uk.

    Setup.exe automatically runs 'prepare' the PC for the Windows installation. The option allows to select personal folders are to remember, I chose 'Nothing' (I also tried another option). After reaching 100% of the given progress the PC is reset.

    The blue brand (8) window so that the circle of progress under and then all of a sudden I get an instant error on a light blue background, something like: ":-(". The installation could not be completed.
    I'm not sure of the message because it only flashes for a second and then reboots the PC. Back to the Vista, a message from window 8 installation could not be completed without further indication of what might have gone wrong.
    Some information on my system:
    Intel Pentium Dual Core 2.5
    6 GB OF RAM
    Important: During the described process I had a dual boot OS, Ubuntu 12 and Windows Vista. Then I formatted all realizing finally that it is explicitly a DVD upgrade and it won't work for any new installation.
    In any case, I'm really frustrated by the upgrade experience. I never had something similar, not even with Trash OS like Windows Me.
    Any feedback/direction would be really appreciated. Thank you.
    Kind regards
    Dimtiris

    Hi Rohit, André,

    I want to thank you for posting on the thread.
    After some trial and error, I finally had. Here's what I did:
    I started by trying to install Windows 7 to then use as the basis for the upgrade of Windows 8 (Vista installation was not good enough since it is 32-Bit allows do not directly upgrade to 64-bit operating system)-here I was getting an exception (BLUE) screen with the error code several different so I started to answer one by one
    1 removed all USB and other devices outside mouse & keyboard (lock was apparently a Logitech camera)
    2 update BIOS of ASUS motherboard to the latest version
    3. I had two different pairs of RAM modules using different frequencies. (2x2gb, 2 x 1 GB). I removed a pair.
    Everything worked well, Windows 7 was installed successfully, and then I continued with an upgrade of Windows 8 smooth.
    Lessons learned: incompatibilities HW should consider significant problems during the upgrade.
    Kind regards
    Dimitris
  • How can I join an existing email, I have forwarded to my address to another email address, I want to send him without having to open the attachments

    I am trying to send a copy of an email to another email address. As I had deleted the email I forwarded your new to my e-mail and now I want to sent to another email address.  It has attachments with it and when I try to pass it on to the new address can not send it without having to open the attachments and I have to send it without doing it would be someone has any ideas please?

    You don't mention your e-mail program, but you probably have an option to forward as an attachment. Who will show new text until they open the attachment. Send it to yourself to test.
  • How do I display values skyrocket in the IR filter for the joined table columns?

    Hello

    I have a problem in the IR the query is based on a table, joined with other tables. I would like to provide users the ability to use IR filter search bar in the joined table columns. The problem facing on this filter, the Expression field, by pressing the arrow button displays values for the fields in the primary table, but not for fields that come from joined tables. Have you experienced this behavior in your reports? Is this normal?

    TIA

    Hello

    Correlated subqueries can improve performance - but it does not depend on the involved tables, the number of columns and the existence of indices. As far as I know, the optimizer has problems with them. You could try to explain the Plans on the two statements to verify that.

    In any case, I created a new test page with the SQL for IR:

    SELECT E.EMPNO,
    E.ENAME,
    D.DEPTNO,
    D.DNAME,
    E2.EMPNO "EMPNO2",
    E2.ENAME "ENAME2"
    FROM EMP E, EMP2 E2, DEPT D
    WHERE E.EMPNO = E2.EMPNO(+)
    AND E.DEPTNO = D.DEPTNO(+)
    AND E2.PRIMARY_EMPLOYEE(+) = 'Y'
    

    http://Apex.Oracle.com/pls/OTN/f?p=267:226

    As far as I can see, it works properly - except that if I do a filter on the ename column, when I try to create a second filter, drop-down lists ename all the values, while the other columns list only the available values after having applied the first filter. Which seems strange that the filters are applied as ANDS. But it does the same thing for other areas - IE, the field used in a filter is not filtered for the second filter - so I guess this is normal, but only a person in Apex could probably explain why it is so.

    Otherwise, everything seems to work as I expect and the above page works the same as my test page, which uses external joins http://apex.oracle.com/pls/otn/f?p=267:224

    Andy

  • How I bounce back without having to change the setting of 'Protection against overload only' amateur off EACH time?

    How I bounce back without having to change the setting of 'Protection against overload only' amateur off EACH time?

    This setting should be preserved, once you set it... so I'm not sure why you have to define every time...

    Then... Make sure that you put on ALL the tools of the art of logic in the preferences of LPX...

    Otherwise... you may need to reset the prefs of LPX... Put all the Tools Advanced again and the other preferences you have set... and see if that fixes things for you...

    You can resolve many issues by restoring Logic Pro X back to its original settings. This will not affect your media files. To reset your settings preferences of the user to Logic Pro X to their original state, do the following:

    1. Logic Pro X to quit smoking
    2. In the Finder, select go to folder menu reach.
    3. Type ~/Library/Preferences in the field 'go to folder '.
    4. Press the Go button.
    5. Delete the com.apple.logic10.plist file from the Preferences folder. Note that if you set custom shortcuts, it will reset to the default values. You can export your custom key as a preset before performing this step. See the Logic Pro X user manual for details on how to do this.
    6. If you are having problems with a control surface in Logic Pro X, you can also delete the com.apple.logic.pro.cs file in the Preferences folder.
    7. Restart the computer.

    Note: If you cannot find the files listed above, you don't follow the instructions properly!

  • I started having problems with the wireless mouse and the carpet of my laptop - Lenovo ThinkPad T420 mouse.

    Original title: right click on the mouse itself activating

    I borrowed a USB to a person at work and I started having problems with the wireless mouse and the carpet of my laptop - Lenovo ThinkPad T420 mouse. The left click of two devices works normally, however, sometimes she does not respond to clicks and it takes a few seconds to work. The left button was constantly starts to turn on, as if he was stuck. After that I hit Alt + Tab and modify windows it stops for a few moments and starts at a later date. I havo not found a specific condition or a combination of keys that may trigger the fault.

    I read a few posts on discussion forums, but all say that it could be a hardware problem, which I think is not, because both devices have the same problem and I'm sure it all started with the insertion of the borrowed memory stick. I scanned the readers to help Symantec's EndPoint Protection and installed Microsoft Security Essentials and performed a full scan, but found nothing. I even restored the system, but the problem remains.

    Should I get a different antivirus? How can I find the cause so I can find a better targeted solution?

    Try to install the drivers from this link and check.

    http://support.Lenovo.com/en_US/research/hints-or-tips/detail.page?&LegacyDocID=MIGR-77167

  • Question of Smartphones on how blackBerry torch performs the voice command dialing

    The torch requires a data connection to the internet to dial by voice command?  My Pearl dial any number in my repertoire by voice command.  It requires no "training".

    I checked on Android - based phones - they all connect to the Internet to perform voice dialing - therefore, require a data plan.

    I like the touch screen of the torch, but it want voice dialing by recognizing my directory names without having to access the Internet.   None of the vendors selling BlackBerry can answer that.

    No, you don't need an internet connection to use voice dialing on a BlackBerry phone.  You talk, he listens to, end of story.

    It's how good BlackBerry are devices.

  • Is anyone having problems with the last lR? I can't do to apply effects to develop at all. I have to force to leave whenever I try to use it.

    Is anyone having problems with the last LR?

    I can't do the effects to apply to develop and I have to force to leave whenever I try to use it.

    I have absolutely nothing accomplished recently - it has worked so well.

    I created enough space on my hard drive thinking that this might be a cause of slow operation but he has not made the difference...

    Hi GKVsiuals,

    suggest make you in Lightroom preferences > performance > uncheck 'use graphics processor' and restart Lightroom to check again.

  • Cannot perform the operation while the host belongs to a Windows domain.

    Hello

    I'm trying to change recording alter DNS for a host of esx5.1 via vCenter but the following error;

    Cannot perform the operation while the host belongs to a Windows domain.

    The host is joined to the domain, but has a static IP configuration. I prefer to change registration without disrupting the VM on the host.

    Any advice would be appreciated

    Thank you

    M

    FYI, I got this problem by leaving the field, change the DNS settings, and then join the domain.

  • Objects of scheme of access without having to specify the user.

    I just created a role in a scheme and assigned to certain privileges. Then, I created a user and granted the role to him. But as the newly created user is not the owner of the schema when I say a query select simle like this:

    SELECT EMLOYEENAME FROM EMPLOYEES

    I get the error "table or view does not exist. Is there a way I can wirte to refer to objects in this schema without having to identify the owner. For example, instead of writing to SCOTUS. I want to write just the EMPLOYEES EMPLOYEES.

    >
    So, I create SYNONYMS for all objects in the right of the schema? And also, I have to use these synonyms in all procedures, functions and views rather than their real names?
    >
    Yes, if the procedures are not owned by the user who owns objects.
    A procedure created by SCOTT didn't need to use the synonym to access the objects belonging to SCOTT.

    Then, if you issue

    GRANT EXECUTE ON scottProcedure1 TO DAVID
    

    Then the user DAVID can perform the Procedure1 scott without the need to have privileges on scott objects used by the procedure.

       EXEC SCOTT.PROCEDURE1;
    

    DAVID must use the schema to perform the procedure, unless you create a synonym for the procedure.

  • I started having a * before the amount of email in some of my inboxes

    I started having a * before the number of emails not open in some of my inboxes in thunderbird. It isn't really a problem in itself, do not understand why it is in some and not others.

    She says that some of the messages being counted may be inside subfolders. It is an indication to the user that it may need to look beyond the obvious of messages Inbox.

    I use view | Records | Unread, so I care where are hide unread messages.

  • The print is so small. How can define you default largest size print without having to click the icon on each page?

    The print is so small. How can define you default largest size print without having to click the icon on each page?

    The Firefox Page Zoom feature makes a domain level by area to save favorite settings level users zoom, there is no default Page Zoom level setting in Firefox, as with some other browsers.

    Try the extension Default FullZoom Level:

    https://addons.Mozilla.org/en-us/Firefox/addon/6965

    Or the NoSquint extension:

    https://addons.Mozilla.org/en-us/Firefox/addon/2592/

  • El Capitan - mail rules > ' perform the following Actions: "menu drop-down is hidden.

    Here's the problem: after setting up the mail in El Capitan and synchronization iCloud with mail rules (the rules are still intact), I noticed a strange thing trying to adjust my Mail rules to filter emails with a few new subfolders. Rules are still in place and function (i.e. ' if one of the following conditions is met:' of > Contains > E-mail address > (+ other rules), then, "perform the following actions:' such as moving, e-mail message, icon bounce, etc."), but the top drop-down selector below him "perform the following...". "section, which in my case is generally" move message to: (name of the folder here) ", is hidden from view. It's still there, but I can't physically click top because the table/cell/div that contains this selector is compressed or not large enough to display the menu drop down. I know that this is true is because the other rules that make them several "Perform" actions... ' display the actions of second and third, but are hidden one.

    This is a problem because if I add another "' move to ' action, it is in conflict with the first... but I can't delete the first action, because I can't click on it."

    I realize that it is a strange... Anyone have any suggestions on how to fix this?

    Thank you

    Shane

    You may need to scroll down to see all the criteria and actions in a rule.

  • How can I configure a new TimeCapsule for an existing network without having to activate the internal networks?

    I tried to go in advance and choose "Add TimeCapsule to the existing network", but it keeps defaulting to 'add a new network '.

    without having to activate the internal networks?

    "Add TimeCapsule to the existing network.

    You cannot add a TC in an existing network, if there is.

    You must configure the TC for the network.

    It keeps default back to "add a new network.

    So, it's OK... The TC is part of an existing network or makes a new.

    You must connect to the TC network... either wireless or ethernet.

    However, you can manually configure the TC simply plug ethernet for example.

    See, cable using Time Capsule for Mac for backup only.

    The same can be done for the wireless... but a TC is really the bad device for backups if you don't have a network... It's cheaper, faster and more reliable by using a USB key.

  • Freeze frame disappears when the join clips

    I have iMovie 10.1 on my new iMAC.    I have a video playing a few seconds of game my son lax.   Then I divide and added a stop on image - to stop the action for 2 seconds (I am also a PIP for him put an arrow).    Then I left the second clip continue.

    I'm trying 2 necklaces... so that it becomes a clip with the still image in the middle... but it won't work.    The still picture always disappears.      Any thoughts on how to stick around?

    I'm not quite clear why you want to join the clips.  They will be joined when you share the movie.

    The join function only to cancel a split of the previous.

    Geoff.

Maybe you are looking for