Problem with joining several tables

Hello PL/SQL gurus and experts.

I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I followed two tables

Student-
drop table TT3;
create table TT3(FeesCntlr,CommCntlr,LatePayCntlr,Name,Age) as select
1,11,21,'Mike',25 from dual union all select
2,12,22,'Clark',26 from dual union all select
1,11,21,'Mike',27 from dual union all select
4,17,27,'Ussan',28 from dual union all select
5,13,21,'Linda',29 from dual union all select
6,14,24,'Obrek',35 from dual union all select
7,15,25,'Batty',45 from dual union all select
8,16,26,'Nicky',38 from dual union all select
1,11,21,'Mike',25 from dual union all select
2,12,22,'Clark',26 from dual union all select
1,11,21,'Mike',27 from dual union all select
4,17,27,'Ussan',28 from dual union all select
5,13,21,'Linda',29 from dual union all select
6,14,24,'Obrek',35 from dual union all select
7,15,25,'Batty',45 from dual union all select
8,16,26,'Nicky',38 from dual ;
Fees-
drop table TT4;
create table TT4(FeesCntlr,CommCntlr,LatePayCntlr,Fees,Commission,Latepayment) as select
1,11,21,25000,4456,223 from dual union all select
2,12,22,356000,3321,0 from dual union all select
1,11,21,456000,223,33 from dual union all select
4,17,27,32890,0,0 from dual union all select
5,13,21,0,778,223 from dual union all select
6,14,24,332567,222,0 from dual union all select
7,15,25,228990,22,0 from dual union all select
8,16,26,0,0,2234 from dual union all select
1,11,21,22345,0,0 from dual union all select
2,12,22,2222789,2,33 from dual union all select
1,11,21,334567,0,0 from dual union all select
4,17,27,9987250,2,33 from dual union all select
5,13,21,2227890,0,0 from dual union all select
6,14,24,2278231,0,3345 from dual union all select
7,15,25,223456,2,0 from dual union all select
8,16,26,223890,0,0 from dual ;
I am looking forward to the fees, commissions and surcharges output for each student and by using the following SQL code.
select t3.Name,t3.age,t4.Fees
from tt3 t3, tt4 t4
where t3.FeesCntlr=t4.FeesCntlr
union
select t3.Name,t3.age,t4.Commission
from tt3 t3, tt4 t4
where t3.CommCntlr=t4.CommCntlr
union
select t3.Name,t3.age,t4.Latepayment
from tt3 t3, tt4 t4
where t3.LatePayCntlr=t4.LatePayCntlr
but it gives me not the correct result and showing a lot of entries and display only the "Expenses" column then only I'm looking for the output to be -
Name     Age     Fees          Commission     Laypayment
Mike     25     837912          4679          256
Clark     26     2578789          3323          33
Ussan     36     10020140     2          33
Linda     38     2227890          778          223
Obrek     38     2610798          222          3345
Batty     32     452446          24          0
Nicky     23     223890          0          2234
Kindly help me with this. Thank you in advance for your time and effort.

Hello

I see your table TT3 has duplicated lines. A reason for this?

Rather than run a separate, I created it without duplicated lines:

create table TT3(FeesCntlr,CommCntlr,LatePayCntlr,Name,Age) as select
1,11,21,'Mike',25 from dual union all select
2,12,22,'Clark',26 from dual union all select
4,17,27,'Ussan',28 from dual union all select
5,13,21,'Linda',29 from dual union all select
6,14,24,'Obrek',35 from dual union all select
7,15,25,'Batty',45 from dual union all select
8,16,26,'Nicky',38 from dual;

create table TT4(FeesCntlr,CommCntlr,LatePayCntlr,Fees,Commission,Latepayment) as select
1,11,21,25000,4456,223 from dual union all select
2,12,22,356000,3321,0 from dual union all select
1,11,21,456000,223,33 from dual union all select
4,17,27,32890,0,0 from dual union all select
5,13,21,0,778,223 from dual union all select
6,14,24,332567,222,0 from dual union all select
7,15,25,228990,22,0 from dual union all select
8,16,26,0,0,2234 from dual union all select
1,11,21,22345,0,0 from dual union all select
2,12,22,2222789,2,33 from dual union all select
1,11,21,334567,0,0 from dual union all select
4,17,27,9987250,2,33 from dual union all select
5,13,21,2227890,0,0 from dual union all select
6,14,24,2278231,0,3345 from dual union all select
7,15,25,223456,2,0 from dual union all select
8,16,26,223890,0,0 from dual ;

  SELECT t3.name, t3.age, SUM (t4.fees) fees, SUM (t4.commission) commission
       , SUM (t4.latepayment) latepayment
    FROM tt3 t3, tt4 t4
   WHERE     t3.feescntlr = t4.feescntlr
         AND t3.commcntlr = t4.commcntlr
         AND t3.latepaycntlr = t4.latepaycntlr
GROUP BY t3.name, t3.age;

Output:
NAME         AGE       FEES COMMISSION LATEPAYMENT
----- ---------- ---------- ---------- -----------
Mike          25     837912       4679         256
Ussan         28   10020140          2          33
Linda         29    2227890        778         223
Clark         26    2578789       3323          33
Obrek         35    2610798        222        3345
Nicky         38     223890          0        2234
Batty         45     452446         24           0

Kind regards.
Al

Published by: Alberto Faenza on November 6, 2012 12:40

Tags: Database

Similar Questions

  • Join several Tables versioned

    Hello

    We are working on a data warehousing project and wonder how do to join several tables that each are versioned separately (type SCD 2 with a valid and valid to date).

    Because for example, we get our client from a single source of information (id customer, name, etc.) and the information on the rate of customer from another source.  The sources are different, we have the separate tables for them and each of them gets versioned independently.

    Here's my customer table (with its own valid and valuable to the columns).

    IDName of the customerValid fromValid until the
    1CitiBank1 JANUARY 14JANUARY 1, 15
    1New CitiBank2 JANUARY 15FEBRUARY 1, 15
    1Latest CitiBank2 FEBRUARY 15APRIL 1, 15

    And similarly the Client side ID and rating information.

    IDNoteValid fromValid until the
    1Platinum1 JANUARY 14FEBRUARY 1, 14
    1PremiumFEBRUARY 1, 141ST MARCH 15

    I want to merge the two tables above and present information at a glance.  I have some difficulty to determine validates the valid columns.

    IDName of the customerNoteValid from (Calculated)Valid until the (calculated)
    1CitiBankPlatinum1 JANUARY 14FEBRUARY 1, 14
    1CitiBankPremiumFEBRUARY 1, 14JANUARY 1, 15
    1New CitiBankPremium2 JANUARY 15FEBRUARY 1, 15
    1Latest CitiBankPremium2 FEBRUARY 151ST MARCH 15

    And it's the query I used to get the above result:

    SELECT client. id ,

           customer . name ,

           CRM . level ,

           Greatest (client. vld_fm , crm. vld_fm ),

           Least (client. vld_to , crm. vld_to )

    DE    client client,

           client_rating crm

      client. id = crm. id

           AND ( client. vld_fm <= crm. vld_fm

                 AND client. vld_fm <= crm. vld_to

                 AND client. vld_fm >= crm. vld_fm

                 AND client. vld_fm >= crm. vld_to )

            OR ( client. vld_fm BETWEEN crm. vld_fm AND crm. vld_to )

            OR ( client. vld_to BETWEEN crm. vld_fm AND crm. vld_to );



    The problem is we have several data sources (and each with its own versions) and joins become so very very complex.  Is there a better way to write the query?

    Or maybe a better way to design our tables?

    Thanks for your help.

    Anand

    Hello

    you only need ranges that overlap to join.

    Re: How do to sql query in a loop

    Is a simpler way to test if the x_start to x_stop range comes into conflict with the range of y_start to y_stop

    WHERE     x_start <= y_stop AND     y_start <= x_stop
    

    In other words, two overlapping if and only if everyone will start before the other ends one. If this is not obvious (and it was certainly not clear to me when I heard it), then look at it this way: two ranges are not overlapping if and only if one of them starts after the end of the other.

    Concerning

    Marcus

  • problem with join

    Hello Experts,

    I'm having a little problem with joining me. its not taking the values that should be
    declare
    l_start_file_name varchar2(50) := 'liab_report_summary_p008_c';
    l_end_file_name varchar2(50)   := '_english.rep';
    l_file_name varchar2(100);
    l_sql varchar(32767);
    refresh_cdc varchar2(10) := '00540';
    
    Begin
    
    l_file_name := l_start_file_name||REFRESH_CDC||l_end_file_name;
    
     l_sql := 'create or replace directory GTECHFILES as ''/ftpfiles/gtechfiles/acct_'||REFRESH_CDC||'''';
      execute immediate l_sql;
    
    
    l_sql :=  ' CREATE TABLE LOTO_LIABILITY_REPORT_temp             '||
              ' (                                                   '||
              '  draw_number       varchar2(50),                    '||
              '  total_winners_amt number,                          '||
              '  paid_today_amt    number,                          '||
              '  total_paid_amt    number,                          '||
              '  expired_today_amt number,                          '||
              '  total_expired_amt number,                          '||
              '  frac_round_amt    number,                          '||
              '  outstanding_amt   number                           '||
              ' )                                                   '||
              ' ORGANIZATION EXTERNAL                               '||
              '   (  TYPE ORACLE_LOADER                             '||
              '     DEFAULT DIRECTORY GTECHFILES                    '||
              '     ACCESS PARAMETERS                               '||
              '       (                                             '||
              '      RECORDS DELIMITED BY NEWLINE                   '||
              '    BADFILE TEMPDIR:''loto_liability_report.bad''    '||
              '    DISCARDFILE TEMPDIR:''loto_liability_report.dis'''||
              '    LOGFILE TEMPDIR:''loto_liability_report.log''    '||
              '      SKIP 8                                         '||    
              '      FIELDS LDRTRIM                                 '||
              '      MISSING FIELD VALUES ARE NULL                  '||
              '       (                                             '||
              '  draw_number       (1:11)  char(11),                '||
              '  total_winners_amt (14:24) char(11),                '||
              '  paid_today_amt    (26:36) char(11),                '||
              '  total_paid_amt    (38:48) char(11),                '||
              '  expired_today_amt (50:60) char(11),                '||
              '  total_expired_amt (62:72) char(11),                '||
              '  frac_round_amt    (74:80) char(7),                 '||
              '  outstanding_amt   (82:92) char(11)                 '||
              '       )                                             '||
              '   )                                                 '||
              '     LOCATION ('''||l_file_name||''')                '||
              ' )                                                   '||
              ' REJECT LIMIT UNLIMITED                              '||
              ' NOPARALLEL                                          '||
              ' NOMONITORING                                        ';
    
             execute immediate l_sql; 
    
    
     l_sql := ' insert into LOTO_LIABILITY_REPORT '||
     ' ( draw_number             , '||
     '   total_winners_amt       , '||
     '   paid_today_amt          , '||
     '   total_paid_amt          , '||
     '   expired_today_amt       , '||
     '   total_expired_amt       , '||
     '   frac_round_amt          , '||
     '   outstanding_amt         , '||
     '   source                  , '||
     '   inserted_DATE           , '||
     '   CDC                     , '||
     '   draw_start_date         , '||
     '   draw_end_date             '||
     ' )                           '||
     '   SELECT                    '||
     '       a.to_number(substr(draw_number,1,instr(draw_number,''/'',1)-1)) , '||
     '       a.total_winners_amt                                             , '||
     '       a.paid_today_amt                                                , '||
     '       a.total_paid_amt                                                , '||
     '       a.expired_today_amt                                             , '||
     '       a.total_expired_amt                                             , '||
     '       a.frac_round_amt                                                , '|| 
     '       a.outstanding_amt                                               , '||  
     '       '''||l_file_name                                           ||''', '||
     '       sysdate                                                         , '||
     '       '''||refresh_cdc                                           ||''', '|| 
     '       b.start_date                                                    , '|| 
     '       b.end_date                                                        '|| 
     '    FROM                                                                 '||
     '       a.LOTO_LIABILITY_REPORT_temp                                     ,'||
     '       b.draws                                                           '||
     '    where                                                                '||
     '       a.draw_number is not null                                         '||
     '    and                                                                  '||
     '       a.total_winners_amt is not null                                   '||
     '    and                                                                  '|| 
     '       a.to_number(substr(draw_number,1,instr(draw_number,''/'',1)-1))= b.num ';
    
     
        dbms_output.put_line(l_sql);
             execute immediate l_sql;           
             
    l_sql :='drop table LOTO_LIABILITY_REPORT_temp';
     
            execute immediate l_sql;
            
    exception
    when others then
    rollback;
    l_sql :='drop table LOTO_LIABILITY_REPORT_temp';
    execute immediate l_sql;
    debug_message('LOTO_LIABILITY_REPORT_temp_UPLOAD/'||REFRESH_CDC,'Unexpected Error '||sqlerrm);
    END LOTO_LIABILITY_REPORT;

    at least

     '    FROM                                                                 '||
     '       LOTO_LIABILITY_REPORT_temp a                                     ,'||
     '       draws b                                                           '||
     '    where                                                                '||
    

    Concerning

    Etbin

  • Update statement with joins of tables and where Clause

    Hi, I have MS SQL background and I try to execute an update statement in Oracle with joins of tables. However, the syntax below does not work but I think it works for MS SQL.

    Basically, the base table must be attached to a master table trend with monthly snapshots, an account will be only an entry for a given date monthly. Where clause must be limited to accounts within a certain range of interest rates.

    The first approach returns command SQL ORA-00933 not correctly completed, and the second approach returns ORA-01427 row below query returns multiple rows. Can anyone help? Thanks in advance!



    1:

    Update PenaltyAll
    Set a.indicator = month (b.)
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    where a.monthend='01/31/2009' and b.date='12/31/2008' and b.apr < 20

    2:

    Update PenaltyAll
    adjustment indicator =
    (select to_char (b., 'MM')
    of PenaltyAll an inner join Master b on a.acctno = b.accountnumber
    "where to_char (a.monthend,'mm/dd/yyyy ') = 31 January 2009"
    (et to_char(b.date,'mm/dd/yyyy') = December 31, 2008 "
    and b.apr < 20)

    Published by: sqlrookie on August 21, 2009 07:04

    I edited my post, that was my mistake, ANC you try now?

  • problem with join of two tables

    Hi, consider the following data
    WITH data AS
    (
      SELECT 123 cid, 'aaa' isi, 'kkk' sud, 'ttt' ri FROM dual UNION ALL 
      SELECT 222 cid, 'bbb' isi, 'gggg' sud, 'hhh' ri FROM dual
    
    ) ,
    data2 AS 
    (
      SELECT 'aaa' isi, 'yyy' sud, 'ooo' ri FROM dual UNION ALL 
      SELECT 'qqq' isi, 'ggg' sud, 'ooo' ri FROM dual UNION ALL 
      SELECT 'uuu' isi, 'ppp' sud, 'ttt' ri FROM dual UNION ALL
       SELECT 'ppp' isi, 'mmm' sud, 'nnn' ri FROM dual 
    
    
    )
    what I want to do, is to join data2 with data by isi, ri or southern id table and produce this output.
     cid  txt
     ===  ====
     123  aaa
     222  ggg
     123  ttt
    It's how I got the above output:
    first try to join isi in database2 with isi in "features" and discover if line matches. If this is the case, display the cid of the data table and the use of the value to match.
    e.g. in the first line of table data2, we can see that isi = aaa matches line an isi data table. If the output displays 123 and value aaa.

    If the rank table two of the Data2 isi = qqq. When join them with the data table, we find not all isi with qqq. in this case, it must join with column of South. We can see that South = ggg data2 games
    the second line in the table of output so will bee 222 and value ggg.

    now, take a look at the third row in Database2. ISI = uuu is not found in the data table when join them. then try to join to the South. South = ttt is also not found in any row of the data table. so join with ri. We
    can see that ri = ttt data2 matches with ri = ttt in the table of data online 1. Therefore, we display the value.

    can someone help me write a sql query that joins these two tables by isi. If no line found then join South, if no found rows then join in ri? Thank you

    Hello

    elmasduro wrote:
    Hi Frank, data2.sud = 'Gay' (4 characters) assume to be South = "ggg". by mistake, I type extra g.

    I have another question about the request. What happens if I want to bring rows of data.2 even if they do not exist in the data table for the entire column was join?
    for example, I want to show this:

    cid  txt
    ===  ====
    123  aaa
    222  ggg
    123  ttt
    ppp  --row from data2
    

    the columns of the last row of data.2 does not match any column in the data table. in this case, I want to make but cid will be null. I tried outer join on your request, but it looks like I can not clause or with outer join

    SELECT     d1.cid
    ,     CASE
              WHEN  d1.isi = d2.isi  THEN  d2.isi
              WHEN  d1.sud = d2.sud  THEN  d2.sud
                                            ELSE  d2.ri
         END     AS txt
    FROM data     d1
    JOIN     data2     d2  ON     d1.is(+)i     = d2.isi
                  OR     d1.sud(+)     = d2.sud
                  OR     d1.ri(+)     = d2.ri
    ;
    

    How can I re - write the query for this case? Thanks again for your help

    Here is the outer join syntax:

    SELECT     d1.cid
    ,     CASE
              WHEN  d1.isi = d2.isi  THEN  d2.isi
              WHEN  d1.sud = d2.sud  THEN  d2.sud
              WHEN  d1.ri  = d2.ri   THEN  d2.ri
                                            ELSE  d2.isi
         END     AS txt
    FROM          data2     d2
    LEFT OUTER JOIN     data     d1  ON     d1.isi     = d2.isi
                           OR     d1.sud     = d2.sud
                           OR     d1.ri     = d2.ri
    ;
    

    The + sign for outer joins only works with the old join syntax, non-ANSI. Do not try to mix the two different ways to do joins.

    Not to mention that the outer join, don't forget to change the CASE expression, to include the new possibility of any columns 3 join matching.

  • Problems with slot-shaped table and set the values of column

    Hello

    I have a problem with a tabular presentation.

    I have two tables

    P_detail and table v_master

    columns of v_master:
    v_id
    v_Name
    v_info

    columns of p_detail:
    P_ID
    p_master_fk
    p_name
    p_info

    I want to have a tabular presentation where I can store permanent data retail values. That's why I want to keep the default main column join the detail columns.
    In SQL, I can do this with an outer join:

    SELECT m.v_name, d.p_master_fk, d.p_name, d.p_info
    OF v_master, p_detail
    WHERE v_id = p_master_fk (+)

    I get the lines that exist for the master data and can add values for the columns of detail. I removed the "add lines" because that makes no sense, because the amount lines are already offered at the opening of the tabular presentation.

    Now, I want to get/save the v_id (main table) in the p_master_fk column value

    How can I do this?

    Thank you and best regards,
    Matthias

    Hello

    One approach is to use a database instead trigger. If you define a database view using the query:

    SELECT m.v_id, m.v_name, d.p_id, d.p_master_fk, d.p_name, d.p_info
    OF v_master m, p_detail d
    WHERE v_id = p_master_fk (+)

    Then, create a trigger on the view that will insert in the detail table if d.p_id is null and update the secondary table if d.p_id is not null instead.

    The Apex tabular form is then based on the view (with identifiers like hidden columns) and all treatments multirow Apex should work without modification.

    Rod West

  • Help for BBM blackBerry Smartphones &amp; Facebook does not not for 9320 - problem with "host Routing Table? -Virgin

    So, today I received my new 9320 at Virgin Mobile, first Blackberry & love the phone! but I can't use the BBM or Facebook app...

    At first I could not even access the browser while that connected to my wifi... then I phoned Virgin & they helped me to reset the settings on my BB that I could use the browser etc...

    I thought it was problem solved, until I discovered BBM and Facebook, use app world separate service? Anyway, I phoned up to Virgin because I wanted to do this job, they are included in my package & I did not understand why I can't access any of them...

    After a long phone call the problem has proved that the "host routing table" was empty and (according to in Virgin) there is a problem with new BlackBerry receiving these details... they said this isn't a problem on the end there & told me there is nothing more they can do so to click 'register now' and wait for the details...

    24 hours later and nothing, so I hope someone here can help me, make me a BB the whole point is things miss me actually lol and I feel now I'm paying for a phone contract I can't really use it, without any help from my provider?

    Any help?

    Or

    Anyone with a new BB knows something like that recently? Thank you

    Wow... Virgin you gave really there. You see, you PAY for 100% of your services and 100% of your formal support... at the moment, they seem to be or you deliver. Only they have the ability (in fact the RESPONSIBILITY!) to degenerate RIM requiring improved support of cases (from your description, it must be that... with a HRT empty, nothing that anyone here can do). End users have no free path to receive assistance from the RIM at all - only via the escalation. So, what I would do if I were you, is their ring back... but this time do not let you fob OFF... insist that, because you HAVE them, you have a contract with them and they are about to be in violation of this contract - they must solve your problem, degenerate into RIM if they wish.

    Good luck!

  • Outer Join and joining several Tables

    Hello

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product

    I have three tables AddProject, AssociateProjectLead, AddAssociate. Now I'm generating a report who will join AddProject and AssociateProjectLead for a list of all the projects, even if it doenst have a project coordinator. I used the outer join for this. However, if I want the name of the project leader, I need to search for AddAssociate table. By joining this table also, the outer join is no longer valid. Please see the result below

    CREATE TABLE  "ADDPROJECT" 
       (     "VERSIONNO" NUMBER(*,0), 
         "PROJID" VARCHAR2(20), 
         "PROJNAME" VARCHAR2(60), 
         "PROJSTARTDATE" DATE, 
         "PROJSTATUS" VARCHAR2(20), 
         "PROJENDDATE" DATE, 
         "PROJENDTYPE" VARCHAR2(20), 
         "PROJENDREASON" VARCHAR2(1000), 
         "UCPROJECTMANAGER" VARCHAR2(20), 
         "FROMDATE" DATE, 
         "TODATE" DATE, 
         "SRCHFIELD" VARCHAR2(20), 
         "OPERATOR" VARCHAR2(20), 
         "PARENTPROJID" VARCHAR2(20), 
         "PROJHIDDENDATE" VARCHAR2(20), 
          CONSTRAINT "PK_B36" PRIMARY KEY ("PROJID", "PROJHIDDENDATE") ENABLE
       )
    
    
    CREATE TABLE  "ADDASSOCIATE" 
       (     "VERSIONNO" NUMBER(*,0), 
         "ASSOCIATEID" NUMBER(9,0) NOT NULL ENABLE, 
         "ASSOCIATENAME" VARCHAR2(100) NOT NULL ENABLE, 
         "CTOJOINDATE" DATE, 
         "STATUS" VARCHAR2(20), 
         "ENDDATE" DATE, 
         "SRCHFIELD" VARCHAR2(20), 
         "OPERATOR" VARCHAR2(20), 
         "FROMDATE" DATE, 
         "TODATE" DATE, 
          CONSTRAINT "PK_B23" PRIMARY KEY ("ASSOCIATEID") ENABLE
       )
    
    CREATE TABLE  "ASSOCIATEPROJECTLEAD" 
       (     "VERSIONNO" NUMBER(*,0), 
         "PROJLEADASSOID" NUMBER(9,0), 
         "PROJID" VARCHAR2(20), 
         "ASSOCIATEID" NUMBER(9,0), 
         "PROJLEADSTARTDATE" DATE, 
         "STATUS" VARCHAR2(20), 
         "ASSOCPROJHIDDENDATE" VARCHAR2(20), 
         "PROJHIDDENDATE" VARCHAR2(20), 
         "ENDDATE" DATE, 
          CONSTRAINT "PK_B40" PRIMARY KEY ("ASSOCIATEID", "PROJID", "ASSOCPROJHIDDENDATE") ENABLE
       )
    
    
    elect ap.projid,apl.associateid
    from addproject ap, associateprojectlead apl
    where ap.projid = apl.projid(+)
    and ap.projhiddendate = apl.projhiddendate(+)
    
    
    PROJID ASSOCIATEID 
    Proj08 75825 
    Proj09 75825 
    Proj10 75825 
    Proj11 75825 
    Proj12 259811 
    Proj01 103035 
    Proj02 103035 
    Proj03 320092 
    Proj04 320092 
    Proj05 120974 
    Proj06 367393 
    Proj07 117618 
    Proj07 224882 
    Proj07 246652 
    prj001 -  
    prj001 -  
    
    16 rows returned in 0.00 seconds
    
    
    select ap.projid,apl.associateid,aa.associatename
    from addproject ap, associateprojectlead apl,addassociate aa
    where ap.projid = apl.projid(+)
    and ap.projhiddendate = apl.projhiddendate(+)
    and apl.associateid = aa.associateid
    
    
    PROJID ASSOCIATEID ASSOCIATENAME 
    Proj11 75825 Amarendra Kumar Singh 
    Proj10 75825 Amarendra Kumar Singh 
    Proj09 75825 Amarendra Kumar Singh 
    Proj08 75825 Amarendra Kumar Singh 
    Proj02 103035 Rajesh Jayaprakash 
    Proj01 103035 Rajesh Jayaprakash 
    Proj07 117618 Chetan Malhotra 
    Proj05 120974 Perumal Rajaram 
    Proj07 224882 Dilshad Ahmad 
    Proj07 246652 Shankar Kausley 
    Proj12 259811 Arunchandar Arun Vasan 
    Proj04 320092 Venkatesh Sarangan 
    Proj03 320092 Venkatesh Sarangan 
    Proj06 367393 Venkata Ramakrishna P 
    
    14 rows returned in 0.00 seconds
    How can I select all the values in table AddProject?

    Published by: Pramukh on August 23, 2012 12:18

    Hello

    I could get the result with a bit of modification

    select ap.projid,
           apl.associateid,
           aa.associatename
      from addproject ap
           left outer join
           associateprojectlead apl
        on ap.projid = apl.projid
       and ap.projhiddendate = apl.projhiddendate
           left outer join
           addassociate aa
        on apl.associateid = aa.associateid
    

    As a follow-up, I have a request more. In the report form, the user can select a particular project ID and the report should be generated as a result. For example;-he wants to see the results of the only "Proj08". I get the output as below, while the result should display only the details of 'Proj08 '.

    select ap.projid,
           apl.associateid,
           aa.associatename
      from addproject ap
           left outer join
           associateprojectlead apl
        on ap.projid = apl.projid
       and ap.projhiddendate = apl.projhiddendate
       and ap.projID = 'Proj08'
           left outer join
           addassociate aa
        on apl.associateid = aa.associateid
    ORDER BY ap.projID
    
    PROJID ASSOCIATEID ASSOCIATENAME
    Proj01 -  -
    Proj02 -  -
    Proj03 -  -
    Proj04 -  -
    Proj05 -  -
    Proj06 -  -
    Proj07 -  -
    Proj08 75825 Amarendra Kumar Singh
    Proj09 -  -
    Proj10 -  -
    Proj11 -  -
    Proj12 -  -
    prj001 -  -
    prj001 -  -  
    
  • Problem with a light Table in Bridge CS6

    Hello! After a re - install (which does not solve the problem with PS), now, I find that, when you use the light table in Bridge CS6, and after hitting the SPACEBAR, if I then click on the image, it goes to the size of 800%! Before the uninstall and reinstall, it has perfectly worked by taking images at 100% size.

    I hope someone can help...

    Thanks, farming

    Why you reinstall photoshop cs6?

    What operating system do you use?

    You reinstall all updates Photoshop cs6 by going to help > updates within photoshop cs6?

    After you enter the light table, use your mouse wheel to zoom to 100% and leave the light table.

    The next time you go to the lightbox and click on the photo, it should only go to 100%.

  • Oracle 10g - problem with "DELETE from TABLE WHERE ID in (1,2,3)" (use cfqueryparam)

    Hello, everyone.

    I have problems with executing a DELETE statement on an Oracle 10 g server.

    DELETE 
    FROM tableA
    WHERE ID in (1,2,3)
    

    If there is only a single ID for the IN clause, it works.  But if more than one ID is provided, I get an error message "SQL command" not correctly completed.  Here's the query as CF:

    DELETE 
    FROM TRAINING
    WHERE userID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(form.userID)#">
         AND TRAINING_ID in <cfqueryparam value="#form.trainingIDs#" cfsqltype="CF_SQL_INTEGER" list="yes">
    

    Someone at - it works with Oracle that can help me with this?  I'm a developer experienced in MS - SQL; Oracle is new to me.

    Thank you

    ^_^

    So much worse... a colleague just told me I should always use parentheses around the values in the IN clause.

  • Join several tables of two different patterns - is it possible?

    If this is the case, what are the measures?

    THX

    This is the case.

    You must prefix the tables with the schemaname tables is in, or create a synonym for the table. In addition, you must grant select rights from of a the reference schema owner schema:

    SELECT A.*,B.*
      FROM SCHEMA1.TEST_TABLE A,
           SCHEMA2.TEST_TABLE B
     WHERE somecondition
    
  • Select the problem with joined tables

    Hello everyone I have the following query
    SELECT 
        OBJEKTI.OBJEKAT_ID OBJEKAT_ID, 
        OBJEKTI.ADRESA ADRESA, 
        OBJEKTI.POVRSINA POVRSINA, 
        OBJEKTI.BROJ_IZVRSILACA BROJ_IZVRSILACA, 
        OPREMLJENOSTI.OPREMLJENOST_ID OPREMLJENOST_ID, 
        OPREMLJENOSTI.PULT PULT, 
        OPREMLJENOSTI.REKLAMA REKLAMA, 
        OPREMLJENOSTI.MOKRI_CVOR MOKRI_CVOR, 
        OPREMLJENOSTI.WC_ZA_IGRACE WC_ZA_IGRACE, 
        OPREMLJENOSTI.WC_ZA_OSOBLJE WC_ZA_OSOBLJE, 
        OPREMLJENOSTI.VENTILATOR VENTILATOR, 
        OPREMLJENOSTI.OSVJETLJENJE OSVJETLJENJE, 
        OPREMLJENOSTI.VRSTA_BROJILA VRSTA_BROJILA, 
        OPREMLJENOSTI.ELEKTRO_INSTALACIJE ELEKTRO_INSTALACIJE, 
        OPREMLJENOSTI.VODO_INSTALACIJE VODO_INSTALACIJE, 
        OPREMLJENOSTI.TELEFONSKE_INSTALACIJE TELEFONSKE_INSTALACIJE, 
        OPREMLJENOSTI.GRIJANJE_ID GRIJANJE_ID, 
        OPREMLJENOSTI.POD_ID POD_ID, 
        OPREMLJENOSTI.PROZORI_VRATA_ID PROZORI_VRATA_ID, 
        OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID1, 
        TEHNICKE_OPREMLJENOSTI.TEH_OPR_ID TEH_OPR_ID, 
        TEHNICKE_OPREMLJENOSTI.ONLINE_KLADIONICA ONLINE_KLADIONICA, 
        TEHNICKE_OPREMLJENOSTI.PANO PANO, 
        TEHNICKE_OPREMLJENOSTI.NOSACI NOSACI, 
        TEHNICKE_OPREMLJENOSTI.TV_LCD TV_LCD, 
        TEHNICKE_OPREMLJENOSTI.TV_TELETEXT TV_TELETEXT, 
        TEHNICKE_OPREMLJENOSTI.APARATI_IGRE APARATI_IGRE, 
        TEHNICKE_OPREMLJENOSTI.EVONA EVONA, 
        TEHNICKE_OPREMLJENOSTI.NOVOMATIC NOVOMATIC, 
        TEHNICKE_OPREMLJENOSTI.RULET RULET, 
        TEHNICKE_OPREMLJENOSTI.BILIJAR BILIJAR, 
        TEHNICKE_OPREMLJENOSTI.KLIMA KLIMA, 
        TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID OBJEKAT_ID2, 
        PONUDE.PONUDA_ID PONUDA_ID, 
        PONUDE.ONLINE_TERMINAL ONLINE_TERMINAL, 
        PONUDE.SRECKE SRECKE, 
        PONUDE.ONLINE_KLADIONICA ONLINE_KLADIONICA1, 
        PONUDE.APARATI_IGRE APARATI_IGRE1, 
        PONUDE.RULET RULET1, 
        PONUDE.BILIJAR BILIJAR1, 
        PONUDE.OBJEKAT_ID OBJEKAT_ID3 
    FROM 
        OBJEKTI, 
        OPREMLJENOSTI, 
        TEHNICKE_OPREMLJENOSTI, 
        PONUDE 
    WHERE 
    (PONUDE.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID) OR (OPREMLJENOSTI.OBJEKAT_ID=OBJEKTI.OBJEKAT_ID AND TEHNICKE_OPREMLJENOSTI.OBJEKAT_ID=OPREMLJENOSTI.OBJEKAT_ID)
     ORDER BY OBJEKTI.OBJEKAT_ID
    The problem I have is any WHERE clause I use I have double values that makes no sense. I checked in the tables and I not all double values. Each Opremljenost has 1 objekat (there are 2 rows of each with its own Objekat) and this applies to 2 other tables (PONUDE and TEHNICKE OPREMLJENOSTI), but for some reason any that they double values. If I run it without a where clause at all clause, I get a repetition of values itself up to 4 times. Does anyone have an idea what's wrong with my request?

    Well, if all relationships are to 1-1 (1-0), then try this (the names of table/column, but you get what I mean bad):

    select OBJ.*, OPR.*, TEH.*, PON.* -- I know you can't do this, but you get what I mean.
    from OBJ,OPR,TEH,PON
    where OBJ.object = OPR.object (+)
      and OBJ.object = TEH.object (+)
      and OBJ.object = PON.object (+)
    /
    

    its supposed to be a 1 to 1 relationship, but it is not.

    In this case the remedy is very simple: create a UNIQUE constraint on the column of the OBJECT in OPR, TEH and PON...

  • joining several tables to generate data

    with itemlist as

    (select 1 cid, listname 'test', 'r' flg Union double all the)

    Select 2 cid, listname 'test2', ' not flg double

    ),

    category 1)

    Select 1 cid, 122 k' sub '123' catcode, of any double Union

    Select 1 cid, '234i' catcode, sub '124' all Union double

    Select 1 cid, 238 k' void '124' catcode, double

    )

    void)

    Select 1 cid, sub '123' of any union double

    Select 1 cid, sub ' 124' double

    )

    I want to write a static query that gathers all the tables and produces the following output assuming that

    CID is you pass as a parameter

    CID listname flg topic catcode

    1 123 122 k r test

    1 test of r 234i 124

    1 124 238 k r test

    Suppose the data as changes to follow and even cid 1 is to pass as a parameter:

    with itemlist as

    (select 1 cid, listname 'test', 'r' flg Union double all the)

    Select 2 cid, listname 'test2', ' not flg double

    ),

    category 1)

    Select 1 cid, 122 k' sub '123' catcode, of any double Union

    Select 1 cid, '234i' catcode, sub '124' all Union double

    Select 1 cid, 238 k' void '124' catcode, double

    )

    void)

    Select 2 cid, sub '123' of any union double

    Select 2 cid, sub '124' double

    )

    then the output should be

    CID listname flg topic catcode

    1 r test 123

    1 test of r 124

    1 test of r 124

    for a final example, suppose the data now as to user 1 as cid

    with itemlist as

    (select 1 cid, listname 'test', 'r' flg Union double all the)

    Select 2 cid, listname 'test2', ' not flg double

    ),

    category 1)

    Select 2 cid, 122 k' sub '123' catcode, of any double Union

    Select 2 cid, catcode '234i', '124' void in any union double

    Select 2 cid, 238 k' void '124' catcode, double

    )

    void)

    Select 1 cid, sub '123' of any union double

    Select 2 cid, sub '124' double

    )

    output must be

    CID listname flg topic catcode

    1       test            r                 123

    Basically, the user will pass a cid, in this case 1. I'll read the itemlist where cid = 1 and I want to join all the other tables

    to itemlist in such a way that I can generate extra lines.  If no entry is found for cid 1, for example, in category 1 or auxiliary table

    then the beloging column of this table must be null in the result

    can someone help me write a query to produce the output above

    Hello

    elmasduro wrote:

    ...

    Here is an explanation of the output.  a user will have a front screen where it can enter itemlist info.
    then in a submenu may enter a category or sub or both or none of them. the user can select multiple categories or sub
    When the user presses the button Save, an entry will be made in the itemlist table, for example the cid = 1.
    If he choose a category but without Subs, then will be entered into the table at say cid = 1


    but no entries will be made for sub because he chose not to all values.  If he chooses void instead of category values
    then sub taable will fill and category is not. If he chooses the category and under, then both will be filled.

    what I want to do is to join the itemlist with table category and sub table and get the data to the Scriptures, this intervention of the user.
    These entries not found will be the null value column in the result.
    for example, the cid = 1 itemlist, if user enter category but not void, itemlist will be the join with the table category and sub
    but since sub has no entry for the cid = 1, the column object will be empty in the output, but catcode will fill

    I'm so confused.

    It is a query (that is, just a SELECT statement, which shows the data already present in the tables), or is this a DML statement, that will add data to the tables?  If it's just a query, then do not say things like "entries will be taken" or "filled with tables.

    Assuming you want a request maybe you want something like this:

    WITH c_and_s AS

    (

    SELECT NVL (c.cid, s.cid) AS cid

    NVL (c.sub, s.sub) AS topic

    , NVL2 (s.cid, c.catcode, NULL) AS catcode

    CATEGORY 1 c

    FULL OUTER JOIN void s ON c.cid = s.cid

    AND c.sub = s.sub

    )

    SELECT i.cid, i.listname, i.flg

    cs.subject, cs.catcode

    Itemlist I have

    LEFT OUTER JOIN c_and_s ON cs.cid = i.cid cs

    WHERE the i.cid (1) - you can do the cids 2 or several at the same time, if you want to

    ORDER BY i.cid, cs.subject, cs.catcode

    ;

    This example gets the output you asked data sample you posted.

  • Problem with populating a table of facts, of dimension tables

    My goal is there are 5 dimensional tables created

    Student-> primary key s_id, upn(unique pupil no), name
    Rank-> key primary g_id, grade, exam_level, values
    Object-> key primary sb_id, subjectid, subname
    School-> key primary sc_id, schoolno, school_name
    year-> y_id primary key, year (like 2008)

    S_ID g_id sb_id, sc_id, y_id are sequences
    select * from student;
    S_ID UPN FNAME COMMONNAME GENDER DOB
    ==============================
    9062 1027 MELISSA ANNE       f  13-OCT-81
    
    ...
    
    9000 rows selected
    select * from grade;
          G_ID GRADE      E_LEVEL         VALUE
    ---------- ---------- ---------- ----------
            73 A          a                 120
            74 B          a                 100
            75 C          a                  80
            76 D          a                  60
            77 E          a                  40
            78 F          a                  20
            79 U          a                   0
            80 X          a                   0
    ...
    18 rows selected
    It's basically the dimensional point of view

    According to the given specifications, now need to create a table of facts like facts_table that contains all the primary keys of tables IMG as foreign keys in it.

    The problem is when I say, I'll look at an example of smaller that the reality of dimension tables 5 let say there are 2 student dim tables, rank with s_id, g_id as the p key.
    create materialized view facts_table(s_id,g_id)
    as
    select  s.s_id,g.g_id
    from   (select distinct s_id from student)s
    ,         (select distinct g_id from grade)g
    The result is a massive duplication as there is no join between two tables. But basically there is no common things between the two tables to join, how to solve?

    Think of it as when I do for 5 tables the amount of duplication being involved, why there is not enough tablespace.

    I was hoping that if there is no other way then don't create a fact table with just a column at the start
    create materialized view facts_table(s_id)
    as
    select s_id
    from student;
    then
    alter materialized view facts_table add column g_id number;
    Then fill this column g_id fetching all the grade table g_id values using some sort of loop, although we shouldn't use pl/sql, I don't know if it works?

    All of the suggestions.

    TROPPER,

    Your information, I have tried this test see if it works for you

    DROP TABLE fact_1 CASCADE CONSTRAINTS;
    
    CREATE TABLE fact_1 (
       s_id NUMBER NOT NULL,
       sc_id NUMBER NOT NULL,
       g_id NUMBER NOT NULL
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    
    ALTER TABLE student_1
     DROP PRIMARY KEY CASCADE;
    DROP TABLE student_1 CASCADE CONSTRAINTS;
    
    CREATE TABLE student_1 (
       s_id NUMBER NOT NULL,
       student_id NUMBER,
       studentname VARCHAR2 (40 BYTE)
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    
    ALTER TABLE school
     DROP PRIMARY KEY CASCADE;
    DROP TABLE school CASCADE CONSTRAINTS;
    
    CREATE TABLE school (
       sc_id NUMBER NOT NULL,
       school VARCHAR2 (40 BYTE),
       schoolname VARCHAR2 (100 BYTE)
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    
    ALTER TABLE grade
     DROP PRIMARY KEY CASCADE;
    DROP TABLE grade CASCADE CONSTRAINTS;
    
    CREATE TABLE grade (
       g_id NUMBER NOT NULL,
       e_level VARCHAR2 (40 BYTE)
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    
    CREATE UNIQUE INDEX fact_1_u01
       ON fact_1 (s_id)
       LOGGING
       NOPARALLEL;
    
    CREATE UNIQUE INDEX fact_1_u02
       ON fact_1 (sc_id)
       LOGGING
       NOPARALLEL;
    
    CREATE UNIQUE INDEX fact_1_u03
       ON fact_1 (g_id)
       LOGGING
       NOPARALLEL;
    
    CREATE UNIQUE INDEX grade_pk
       ON grade (g_id)
       LOGGING
       NOPARALLEL;
    
    CREATE UNIQUE INDEX school_pk
       ON school (sc_id)
       LOGGING
       NOPARALLEL;
    
    CREATE UNIQUE INDEX student_1_pk
       ON student_1 (s_id)
       LOGGING
       NOPARALLEL;
    
    ALTER TABLE fact_1 ADD (
      CONSTRAINT fact_1_u01
     UNIQUE (s_id),
      CONSTRAINT fact_1_u02
     UNIQUE (sc_id),
      CONSTRAINT fact_1_u03
     UNIQUE (g_id));
    ALTER TABLE student_1 ADD (
      CONSTRAINT student_1_pk
     PRIMARY KEY
     (s_id));
    ALTER TABLE school ADD (
      CONSTRAINT school_pk
     PRIMARY KEY
     (sc_id));
    ALTER TABLE grade ADD (
      CONSTRAINT grade_pk
     PRIMARY KEY
     (g_id));
    ALTER TABLE fact_1 ADD (
      CONSTRAINT fact_1_r01
     FOREIGN KEY (s_id)
     REFERENCES student_1 (s_id),
      CONSTRAINT fact_1_r02
     FOREIGN KEY (sc_id)
     REFERENCES school (sc_id),
      CONSTRAINT fact_1_r03
     FOREIGN KEY (g_id)
     REFERENCES grade (g_id));
    ALTER TABLE fact_1 ADD (
      CONSTRAINT fact_1_r02
     FOREIGN KEY (sc_id)
     REFERENCES school (sc_id),
      CONSTRAINT fact_1_r03
     FOREIGN KEY (g_id)
     REFERENCES grade (g_id),
      CONSTRAINT fact_1_r01
     FOREIGN KEY (s_id)
     REFERENCES student_1 (s_id));
    
     -- This should be the sequence you will loading data
    
    INSERT INTO student_1
    VALUES (3, 1, 'Tropper A');
    
    INSERT INTO school
    VALUES (3, 'new school', 'new school name');
    
    INSERT INTO grade
    VALUES (4, 'a');
    
    INSERT INTO fact_1
    VALUES (3, 4, 4);
    
    commitl
    

    Concerning

  • problem with learning several geometric pattern

    Hello users of Labview,.

    My goal is to load different templates located in the target folder, create one or more models then, perfom some treatment (located in another file) image.
    The example provide in file vision works perfectly but if I change the path, it seems impossible to create a multiple repeat. In fact, I got the following error message:

    Error 1074395628 has occurred to IMAQ learn several geometric patterns

    IMAQ Vision: Image model corresponding invalid geometry.

    Certainly, I do not understand a part but I don't know where is my mistake.

    I add to the multiple associated model, an example of template image and the image to test.

    Please, can I have a help or suggestion to understand this problem.

    Thanks in advance for your help,

    Best regards

    Hi matriax,.

    Good to know it helped.

    Come to your questions,

    -Yes, model geometric information, or even in vision assistant also will not work.

    -In my code too, it does not work. The reason is explained below.

    -Yes, model created with assistatn vision should also work.

    Coming to the creation of a model, there are two geometric methods correspondent-function based and based edge.

    -Labview code uses geometric based function while u have created the model in edge based method.

    -If you see in vision assistant, settings tab, you have the type of algorithm two options. Select the base feature and you should be able to run it and then assistant labview and vision.

    For more details on geometric matching please refer to http://zone.ni.com/reference/en-XX/help/372916L-01/nivisionconcepts/geometric_matching_technique/

    Hope that helps let me know if you have any other questions.

Maybe you are looking for