Issue of joining external / example (not all lines show)

Hi all

I am writing as a complex query and five lines expected are returned.  I can't get the sixth line to show.  At your convenience, can you take a look and point me in the right direction?  I apologize, but I do not understand foreign keys in this example (there are only 11 inserts, so it shouldn't matter).

You should be able to copy / paste the SQL below (the end of this example deletes the tables - so no cleaning required):

CREATE A (NUMBER (10) ALLOCATION A_ID, TABLE)

A_NAME VARCHAR2 (10));

CREATE TABLE R (A_ID NUMBER (10),)

R_ID NUMBER (10),

R_NAME VARCHAR2 (10));

CREATE TABLE C (A_ID NUMBER (10),)

C_ID NUMBER (10),

C_NAME VARCHAR2 (10));

CREATE TABLE RC (R_ID NUMBER (10),)

NUMBER (10)) C_ID;

insert into a values (1000, 'A1');

insert into a values (2000, 'A2');

insert into values of R (1000, 110, "R1");

insert into values of R (1000, 120, "R2");

insert into values of R (1000, 130, "R3");

insert into values of C (1000, 210, "C1");

insert into values of C (1000, 220, "C2");

insert into values of C (1000, 230, 'C3');

insert into values RC (110, 220);

insert into values RC (110, 230);

insert into values RC (120, 230);

-> R

-> C

-> R

-I would like the following result:

-A_NAME R_NAME C_NAME

--  ------ ------ ------

-A1, C1

-A1 R1 C2

-A1 R1 C3

-A1 R2 C3

-A1 R3

-A2

13 SWIFT;

Select a.a_name,

c.c_name,

r.r_name

a

LEFT OUTER JOIN c

WE (a.a_id = c.a_id)

LEFT OUTER JOIN rc

WE (c.c_id = rc.c_id)

LEFT OUTER JOIN r

WE (a.a_id = r.a_id

and rc.r_id = r.r_id)

where a.a_id in (1000,2000)

order by 1,2,3;

DROP TABLE;

DROP TABLE R.

DROP TABLE C;

DROP TABLE RC;

--------------------------

-Output:

--------------------------

-A_NAME C_NAME R_NAME

-- ---------- ---------- ----------

-A1, C1

-A1 C2 R1

-A1 C3 R1

-A1 C3 R2

-A2

-Missing the following line:

-- A1                    R3

-I've got something screwed up with a join

-Any ideas?

Not sure I understand your condition properly, but try this:

Select A.A_NAME, C.C_NAME, R.R_NAME

r

join full RC RC. R_ID = R.R_ID

Full join on C.A_ID C = R.A_ID and RC. C_ID = C.C_ID

just join one on A.A_ID = coalesce(R.A_ID,C.A_ID)

order of A.A_NAME, C.C_NAME, R.R_NAME;

-result

A_NAME C_NAME R_NAME

---------- ---------- ----------

A1 C1

A1 C2 R1

A1 R1 C3

A1 R2 C3

A1                    R3

A2

Tags: Database

Similar Questions

  • Not all lines are displayed in the OBIEE answers

    Hello

    When I include a dimension column (PRODUCT) with my column of fact (AMT SALES), I have only one line of PRODUCT displayed.

    If I select only the PRODUCT column without any column of FACT, I get the list of all PRODUCT(25 rows).

    I used the query generated by OBIEE and he ran into my database and I get all the lists of products and the amount of sales. (25 lines).

    I guess my problem is in my RPD. But where in my RPD should I look for to debug this problem?

    Thank you.

    Published by: ssk1974 on January 11, 2011 13:09

    It is probably correct behavior - you probably only have an existing product in your fact table? If you want to see all the lists of products as well as $0 for the facts, you will need to do an outer join between the dimension and the fact.

    Of course, if your fact table has other products, there are another problem - perhaps joined Sun on the wrong column name or something.

    Hope this helps,
    Scott

  • ISSUE of JOINING external left

    SELECT THE B.ONE, B.SID, A.ONE, B.NAME
    FROM Table1 A
    LEFT OUTER JOIN Table2 B
    ON A.LOC = B.LOC
    and A.LOC_ID = B.LOC_ID
    WHERE A.LOC = 10
    AND A.LOC_ID = 9
    AND A.CAL = 10
    AND B.CAL = 20


    IF both table have value its works very well.
    If A have value and B means null. It returns all empty. My requirement is if B null means that I need a data only with B as a null column

    I tried (B.CAL = 20 or B.CAL IS NULL) but no data...

    Pass 'AND B.CAL = 20' to the join condition.

    SELECT A.ONE, B.ONE, A.NAME, B.NAME
    FROM Table1 A
    LEFT OUTER JOIN Table2 B
    ON A.LOC=B.LOC
    and A.LOC_ID=B.LOC_ID
    AND B.CAL=20
    WHERE A.LOC=10
    AND A.LOC_ID=9
    AND A.CAL=10
    
  • OfficeJet Pro 8600 Pro Plus didn't feel not all lines of text when you try to print from Web sites

    This printer is only 6 months old and all of a sudden, he refuses to print all text content in news, I try to print from Web sites.

    I have done the reset.

    I unplugged the unit and rebooted

    I have alligned heads

    Print all pages of test.  They print correctly.

    I have REPLACED all the ink with brand-new cartrideges.

    Problem still persists.  If I CUT AND PASTE article text in Wordpad, it prints too THIN.

    One last thing... My PRINTING PREFERENCE is set to 'high quality grey '.

    OK, can someone help me?   Very frustrated!  Laughing out loud

    Have you tried to print from another browser?

  • Not all programs show in Add/Remove programs from the control panel

    Help me please when I go to Control Panel then add and remove programs, that nothing comes and he says its finished loading but all my programs and I scanned with norton 360, malwarebytes, SUPERantispyware, and sophos anti-rootkit, and all of them reported anything.

    Why not post on a forum that is more appropriate for your operating system Windows-
    http://social.answers.Microsoft.com/forums/en-us/group/WindowsAnswers

    This forum addresses the Windows updates.

    Thank you.

    TaurArian [MVP] 2005-2010 - Update Services

  • Not all topics show to new improved 4.2.2.00.11 apex

    Hello

    I just upgraded to 4.1-to-4.2.2.00.11 Apex but trying to change the theme I see themes (blue 6 centered), 18 (simplified gray) and 24 (cloudy)

    But in another application, I can't see theme 21 (scarlet)? and in another application within this instance of the apex, I only see the theme 4 (topaz)

    No idea why this is happening and how can I get a list full of themes available in particular the new RWD 25 theme available on all of my applications on 4.2.2.00.11

    Also, since upgrading my Developer toolbar at the bottom of the screen has disappeared?

    Any ideas on why this is happening and how to solve it, I pass several times firef percent APEX that actually develop something in it

    Hello

    When you create the app or add theme, there are Type of theme selection list in the screen where you see a snippet on the themes.

    Select from this list "all themes".

    For the developer toolbar, see known issues no. 16769040

    Oracle Application Express 4.2.2 - known issues

    Kind regards

    Jari

    Post edited by: jariola

  • iMac does not all photos showing after format

    I recently formatted my iMac, I photo library on disk ext about 98g that if I double click on show all photoes dating back 15 years, if I copy library on mac, still shows 98g but shows only the opening last weeks pictures ideas

    Leave the pictures (or iPhoto) and restart with the command and option/alt keys. Repair of the library.

  • When I create a new email in Windows Mail and start typing to display my contacts list, not all contacts are displayed.

    in windows vista mail when I create a new message and the character of the 1st type (TO, CC) to address in my contacts a menu drop-down Show menu addresses related, but not all contacts show
    in my address book, I have 20 contacts (R) drop-down menu character departures do not show all contacts 20

    original title: windows vista mail

    Windows Mail only remembers 32 addresses. You can delete any part and start over. I normally just click on the button to and add addresses from the list.
     
     
    How to remove an address from the list of AutoComplete in Windows Mail
    http://email.about.com/od/windowsmailtips/Qt/et_del_autocomp.htm 
  • ORA-01008: not all variables ORA-06512: line 1491

    I have a procedure running dynamic SQL in a package that compiles fine, but get an error ORA-01008 not all variables. I have done this before and looked at this for hours but can not fined the problem. Maybe a second set of eyes can help.

    Thanks in advance


    procedure load_patients_by_rule)
    iRuleId in clinical_rule.clinical_rule_id%type,
    iCompanyId number,
    iGroupId number,
    iPatProviderID number,
    RCT outside globalpkg.rct1
    );


    IRULEID: = 55;
    ICOMPANYID: = 520;
    IGROUPID: = 1000001;
    IPATPROVIDERID: = 0;

    procedure load_patients_by_rule)
    iRuleId in clinical_rule.clinical_rule_id%type,
    iCompanyId number,
    iGroupId number,
    iPatProviderID number,
    RCT outside globalpkg.rct1
    )
    as
    SQL_STMT VARCHAR2 (4000);
    Start
    SQL_STMT: ='select r.*,.
    RS.*,
    Reg.clinical_registry_id,
    Reg.Name as registry_description,
    Reg.clinical_registry_type_id,
    Reg.registry_kind,
    PD. DOB,
    FN_GET_ENTITY_FULLNAME (PD.entity_id) as full_name,
    fn_get_rule_interval (r.clinical_rule_id, PD.entity_id) as rule_interval,
    RST.status_description,
    FN_GET_PATPROVIDERID_ENT_GRP (PD.entity_id, RS.group_id) as PAT_PROVIDER_ID,
    GETPATPROVIDERNAME (FN_GET_PATPROVIDERID_ENT_GRP (PD.entity_id, RS.group_id)) as provider_full_name_ex,
    FN_GET_PATIENT_VIP_STATUS(PD.entity_id,PD.parent_company_id) VIP_ACTIVE_YN.
    RGP. ADDED_DATE as added_to_registry_date
    clinical_registry® systems
    My clinical_measure_activation on ma.clinical_registry_id = reg.clinical_registry_id inner join
    clinical_registry_clin_case creg on creg.clinical_registry_id = reg.clinical_registry_id inner join
    clinical_rule_clin_case CCBC on crcc.clinical_case_id = creg.clinical_case_id inner join
    inner join clinical_rule r on r.CLINICAL_RULE_ID = crcc. CLINICAL_RULE_ID
    pat_rule_status rs on rs.clinical_rule_id = r.clinical_rule_id inner join
    inner join rule_status_type on rst.status_id = rs.status_id rst
    RFP pat_details on pd.entity_id = rs.pat_entity_id inner join
    inner join clinical_registry_patient on rgp.clinical_registry_id = reg.clinical_registry_id rgp
    inner join all_name an on PD.NAME_ID = AN.NAME_ID
    where reg. ACTIVE_YN = "Y"
    and rgp.pat_entity_id = pd.entity_id
    and rs.clinical_rule_id =: P1
    and rs.parent_company_id =: P2
    and ma.group_id =: P3
    and rs.group_id =: P3';

    If iPatProviderID = 0 then
    RCT OPEN for SQL_STMT USING iRuleId, iCompanyId, iGroupId; -Line 1491
    on the other
    SQL_STMT: = SQL_STMT | "AND FN_GET_PATPROVIDERID_ENT_GRP (pd.entity_id, rs.group_id) =: P4';"
    RCT OPEN for SQL_STMT USING iRuleId, iCompanyId, iGroupId, iPatProviderID;
    end if;

    end;

    In this case, the variables are not related by name, but by the position, then you will bind each variable (possibly using the same value more than once) in the order they will be displayed in the query:

    if iPatProviderID = 0 then
    OPEN rct FOR SQL_STMT USING iRuleId,iCompanyId, iGroupId, iGroupId;
    else
    SQL_STMT := SQL_STMT || ' AND FN_GET_PATPROVIDERID_ENT_GRP(pd.entity_id,rs.group_id) = :P4';
    OPEN rct FOR SQL_STMT USING iRuleId, iCompanyId, iGroupId, iGroupId, iPatProviderID;
    end if;
    
  • not all of the graphics appear on the screen. For example, on Google chip computer of today does not appear.

    Not all of the graphics appear on the screen. For example, on the homepage Google of today, the graphics chip does not appear. This site, http://www.conifer.jeffco.k12.co.us/conifer/html/index.html - current weather conditions should appear, but they don't.

    This problem was solved when I uninstalled and then installed the new version of JAVA. Thank you for the help you offered.

    WOW great work, I certainly would not have thought of JAVA animations used it but then I don't use "WeatherBug".

  • Lightroom recognizes not all my photos on my external hard drive?

    Lightroom recognizes not all my photos on my external hard drive, he sees the part of a file, but not all the files it contains. Virtually everything is there except that one folder, it says all were imported, but they don't show...

    If you wwant photos will show up in Lightroom on your external drive, you must (in Lightroom), do a right click on the folder on your internal drive that has photos and select Update folder location. Then select the appropriate external hard disk folder. You may get a message asking if you want to merge files, allow this merger.

  • I have PS CC 2014 and 7.3 of Extension Manager installed, but not all extensions appear in PS. All are enabled and up to date versions. For example, Adobe watercolor Deputy. Any suggestions?

    I have PS CC 2014 and 7.3 of Extension Manager installed, but not all extensions appear in PS. All are enabled and up to date versions. For example, Adobe watercolor Deputy. Any suggestions?

    Please see the compatibility on each module table because not all will be compatible with PS CC 2014 and therefore do not list in the extensions under this version of PS Manager.

  • Had a project done with first elements 11.  All media files and PRE files were in the same folder on an external hard drive.  Received a new computer, loaded first items 11 (which of course doesn't recognize not all previous projects as it is)

    Had a project done using first items 11 (the file exported and posted on youtube).  All the media files and PRE files associated with this project were located in the same folder on an external hard drive.  Got a new computer, responsible for first 11 elements (which of course doesn't recognize not all previous projects because it is a new installation) and now cannot open the original project to make some adjustments (connected to the external hard drive of course)...  Even tried to open the last saved auto program as well, no luck.  Just get a shell of the original project, but no real media file is passed in. Then get a prompt asking you where the file "rendering-3090026..." (20 More digits) is located.  Looking for C drive and external hard drive without success. Help!

    delilah12

    Which operating systems are involved - old and new?

    The external drive has the same drive letter on the new computer as it did when it was used on the other computer?

    Where are the video preview and the old led, Audio preview files compared to new? See Edit Menu/preferences/Scratch discs?

    Are all the place where is the file... messages just to render files? If all are for rendering files, what happens if you click ignore for their

    messages? Can you enter into the project and render it again if necessary and proceed with the project?

    Please see the bulletin. With the above information, we will decide which way to go? It seems that a media disconnect situation has developed in

    the passage from one computer to the other.

    RTA

  • Apply line to some but not all sides of a form?

    How can I have a stroke or a scheme to certain parts of a form, but not all?

    Thank you

    The easiest solution is probably to set the form to be completed only clone of the form, set the clone to caress only and then remove the side for which you do not want a shot using the knife tool.

  • Not all the info is pn saw a page

    We have http://www-03.ibm.com/software/lotus/symphony/spreadsheetsForum.nsf/AllByUNID/37D031F1FCD781FE85257A1C0047638C?open & forum = Questions % 20and % 20Troubleshooting & row = 1 of page

    If we open it in Chrome 19.0.1084.56 m, then we see all the info in the topic

    "IBM Lotus Symphony 3 RU on Russian Windows XP Professional SP3 (32 bit)
    We have MS Office 2007 SP3 excel file. Cell A1 contains formula (=(20-2+1)+(31-22+1)+(40-33+1)+1+2+(53-49+1)+2+4+2+1+2+3+3+2+1+1+3+2+1+2+2+2+2+3+1+4+(135-131+1)+2+1+1+(153-147+1)+1+1+2+3+(172-169+1)+1+1+1+1+3+1+(198-194+1)+2+1+1+3+2+2+2+1+(232-225+1)+3+2+2+3+3+1+1+(270-261+1)+(275-272+1)+(282-277+1)+3+2+( 308-292+1)+4+1+1+(325-320+1)+4+1+2+1+1+1+(359-355+1)+2+2+2+(376-371+1)+3+2+1+(392-387+1)+1+2+1+1+1+2+2+4+2+1+2+(437-433+1)+1+1+(450-446+1)+1+5+1+5+1+1+2+1+3+(492-486+1)+4+1+(506-501+1)+(513-509+1)+1+1+1+(531-524+1)+1+1+2+1+3+2+1+1+1+2+(577-571+1)+3+4+5+2+ 1+1+1+1+1+1+3+3+2+1+4+1+1+1+2+2+2+1+3+2+1+1+1+2+1+3+3+3+2+3+2+2+2+6+1+4+3+2+8+3+2+15+1+6+1+3+4+3+4+4+4+2+7+8+1+5) and we have total amount = 536If we try to open that file in Symphony 3 , then we see that cell A1 contains ANOTHER formula, which is truncated =(20-2+1)+(31-22+1)+(40-33+1)+1+2+(53-49+1)+2+4+2+1+2+3+3+2+1+1+3+2+1+2+2+2+2+3+1+4+(135-131+1)+2+1+1+(153-147+1)+1+1+2+3+(172-169+1)+1+1+1+1+3+1+(198-194+1)+2+1+1+3+2+2+2+1+(232-225+1)+3+2+2+3+3+1+1+( 270-261+1)+(275-272+1)+(282-277+1)+3+2+(308-292+1)+4+1+1+(325-320+1)+4+1+2+1+1+1+(359-355+1)+2+2+2+(376-371+1)+3+2+1+(392-387+1)+1+2+1+1+1+2+2+4+2+1+2+(437-433+1)+1+1+(450-446+1)+1+5+1+5+1+1+2+1+3+(492-486+1)+4+1+(506-501+1)+(513-509+1)+1+1+1+(531-524+1)+1+1+2+1+3+2+1+1+ 1+2+(577-571+1)+3+4+5+2+1+1+1+1+1+1+3+3+2+1+4+1+1+1+2+2+2+1+3+2+1+1+1+2+1+3+3+3+2+3+2+2+2+6+1+4+3+2+8+3+2+15+1+6+1+3+4+3+4+4+4+2) et nous avons quantité totale = 515Last opérateurs (+ 7 + 8 + 1 + 5) qui ont été dans MS Office in the Symphony mysteriously disappeared from formula and amount total changed. Symphony shows not all messages. If we try to add missing operators in the Symphony (not even all alone) in the formula, then we immediately get "error 512". Exactly the same problem exists in Apache Open Office 3.4.0 https://issues.apache.org/ooo/show_bug.cgi?id=119451 and Libreoffice 3.5.4 https://bugs.freedesktop.org/show_bug.cgi?id=50419 if perform us the same operations in Microsoft Office 2007 SP3, then fine (we can even add a few operators more, and everything will be fine). I would like to attach files from the example here, but cannot do so. You can see the example files in Bugzilla for the corresponding products. »

    If we try to open this page in FF 13, then we see only the first two lines

    "IBM Lotus Symphony 3 RU on Russian Windows XP Professional SP3 (32 bit)
    We have MS Office 2007 SP3 excel file. Cell A1 contains the formula (= (20-2 + 1)-(31-22-1) +(40-33+1) + 1 + 2 + (53-49 + 1) "+ 2 + 4 + 2 + 1 +")

    and all the other info is truncated.

    The same problem is with Opera 12

    Which is caused by a lack of white-space: pre-wrap; CSS rule.

    Add code to the file in the chrome folder userContent.css

    Customization files (interface) userChrome.css and userContent.css (Web sites) are located in the chrome folder in the user profile folder.

    @-moz-document domain(www-03.ibm.com){
     pre{ white-space: pre-wrap !important; }
    }

Maybe you are looking for