Sum in joined tables

Hello

I have a main table:
t0  t1   t2    t3
1   d    1,81  700
2   d    1.81  800 

and a detail table (t0 e tb0 colums joined)
tb0  tb1 tb2   tb3
1   A   100   0
1   A   200   0
1   B   500   0
2   B   500   0

How can I get this following output?

d     3,62    1500    A  300    0     
                      B  1000   0
because with
select t1, sum(t2), sum(t3), tb1, sum(tb2), sum(tb3) from table1 a, table2 b
where    a.t0 = b.t0
group by t1, tb1
I have no success

Thanks for any help

Well as you said that you were not worried about breaking as you would in the report, I just made the requirement of basic here:

SQL> ed
Wrote file afiedt.buf

  1  with master as (select 1 t0, 'd' t1, 1.81 t2, 700 t3 from dual union all
  2                  select 1 t0, 'd' t1, 1.81 t2, 300 t3 from dual union all
  3                  select 2 t0, 'd' t1, 1.81 t2, 800 t3 from dual)
  4      ,detail as (select 1 tb0, 'A' tb1, 100 tb2, 0 tb3 from dual union all
  5                  select 1 tb0, 'A' tb1, 200 tb2, 0 tb3 from dual union all
  6                  select 1 tb0, 'A' tb1, 500 tb2, 0 tb3 from dual union all
  7                  select 1 tb0, 'B' tb1, 200 tb2, 0 tb3 from dual union all
  8                  select 1 tb0, 'B' tb1, 200 tb2, 0 tb3 from dual union all
  9                  select 2 tb0, 'B' tb1, 500 tb2, 0 tb3 from dual)
 10  --
 11  select m.t0, m.sum_t2, m.sum_t3, d.tb1, d.sum_tb2, d.sum_tb3
 12  from (
 13        select t0
 14              ,sum(t2) as sum_t2
 15              ,sum(t3) as sum_t3
 16        from master
 17        group by t0
 18       ) m
 19  join (
 20        select tb0
 21              ,tb1
 22              ,sum(tb2) as sum_tb2
 23              ,sum(tb3) as sum_tb3
 24        from detail
 25        group by tb0, tb1
 26       ) d
 27  on (m.t0 = d.tb0)
 28* where m.t0 = 1
SQL> /

        T0     SUM_T2     SUM_T3 T    SUM_TB2    SUM_TB3
---------- ---------- ---------- - ---------- ----------
         1       3.62       1000 A        800          0
         1       3.62       1000 B        400          0

SQL>

Tags: Database

Similar Questions

  • DB connectivity Kit: syntax error in a SELECTION of data from joined tables

    Hello everyone

    I'm putting in labview a SQL query on joined tables.

    As an example I take a database to store the data of basketball 2on2 matches, which tables are

    corresponds to (matchId, Thomas, teamB)

    teams (teamId,PlayerAname, PlayerBname, nationality)

    nationalities (NatId, natName)

    To get an array of result with the game as well as the names of player as well as their nationality, I use this query on MySQL (which works on command line interface)

    SELECT MatchID,
    T1. PlayerAName, t1. PlayerBName, n1.natName,
    T2. PlayerAName, t2. PlayerBName, n2.natName
    MATCHES m
    INNER JOIN teams t1 ON t1.teamID = m.teamA
    INNER JOIN teams t2 ON t2.teamID = m.teamB
    INNER JOIN nationalities L1 ON n1.natID = t1.nationality
    INNER JOIN nationalities n2 ON n2.natID = t2.nationality

    When I put it in labview, using the block 'select data', I get a syntax error as shown in the attached screenshot.

    Am I something mistanking using the JOIN examples statements or aliases?

    Thanks in advance!

    The select VI is designed to be a simple way to select from a table. I doubt that he can do joins (and would not certainly need the 'FROM', even if it can). What you can do instead calls the query execute VI and give him the complete SQL query. I don't remember if it returns the data in the recordset object, so you must do so separately.

  • The Master Table column updated based on the sum of column Table detail


    With the help of JDev 11.1.1.6.

    I have a master-detail table based on a link to BC.

    The main table has a column that displays an InputText or an OutputText, based on the value in another column.

    If the InputText is displayed, the user can enter a value and the database will be updated with that value.

    If the OutputText is displayed, it must be a sum of a column in the secondary table.  Also, this value will be written in the database.

    Question:

    How can I fill the OutputText in the main table with the sum of the values in a column in the secondary table?

    The detail table column is a manually entered InputText field.

    Thank you.

    Create a spike in the main table and write in its expression as follows - DetailVoAccessorName.sum ("ColumnName");

    This will calculate the sum of column table detail and then you can set the value of the transient attribute to attribute DB on backup operation

    Ashish

  • DOUBLE join table

    What happens if we want to join table DOUBLE with another table?

    Gul says:
    What happens if we want to join table DOUBLE with another table?

    Not really would you use an equi-join on double because it will always contain a single row and column. Cartesian double with one of the tables will result in the same set of rows, which is at the Table.

    When we get the same result from Tables, why do we use double then?

    Double table is just a convenience table which is / was used to extract the sequence next/Currval, in order to calculate the level of generation etc. Dates missing to know. For more information of the Table double, please read the thread from Tom Kyte. Everything about Table double.

  • Joining tables to Coeherence

    Hello

    What is the way to perform a join in the cache object in coherence - the equivalent of a join table as select a.* from A, B and b where Julien = BK.

    Thank you

    Out of the box, you can't do a join - the consistency is not a database that supports all the things you can do in SQL.

    There are ways to allow certain types of join features. Read this blog which is about the project, I am working currently on (the blog is a colleague) http://www.benstopford.com/2011/09/22/achieving-fast-joins-in-distributed-data-stores-through-the-application-of-snowflake-schemas-and-the-connected-replication-pattern-2/

    JK

  • 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

  • Columns of the sum of different record count of joined tables

    I have a problem with a query, please help.

    I have two tables:
    create table rec_a (key_code varchar(20),
                    TOT_AMT varchar(20),
                    INV_AMT varchar(20))
    / 
     
    create table rec_B (key_code varchar(20),
                    INVOICE_AMT varchar(20),
                   PAID_AMT varchar(20))
    / 
     
    insert into REC_A values (123123,  1168182.16, 1168182.16);
    
    insert into REC_B values (123123, 205699.04,205699.04);
    insert into REC_B values (123123,130912.78,130912.78);
    insert into REC_B values (123123, 81622.87,81622.87);
    insert into REC_B values (123123, 438032.43,438032.43);
    insert into REC_B values (123123, 159936.17,159936.17);
    insert into REC_B values (123123, 151978.87,151978.87);
     
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16


    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87


    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)
    SELECT B.key_code,sum(A.invoice_amt),sum(a.paid_amt),SUM(b.tot_Amt),SUM(b.inv_amt) FROM rec_a B, rec_b A WHERE A.KEY_CODE=B.KEY_CODE AND B.KEY_CODE in ('123123')
    group by B.key_code
    I got this:

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16


    Can someone help me out here?

    Thank you

    Published by: 1003064 on April 29, 2013 03:19

    Hello

    1003064 wrote:
    I have a problem with a query, please help.

    I have two tables:
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16

    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78...
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87

    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)

    SELECT B.key_code, sum (a.invoice_amt), sum (a.paid_amt), SUM (b.tot_Amt), SUM (b.inv_amt) FROM rec_a A, rec_b B WHERE A.KEY_CODE = B.KEY_CODE AND B.KEY_CODE in ('123123')
    B.key_code group

    I got this:
    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16

    Thus, the last 2 columns must be exactly what is stored in table1? Then either
    b include these columns in the GROUP BY clause and not to use the SUM,
    (b) the GROUP BY on rec_a alone, separately, can't join the results to the rec_b, or
    (c) using MIN or MAX, instead of SUM. (Anyone. Since there is only one value, MIN will be the same as MAX.)

    Here is an example of (a):

    SELECT    B.key_code
    ,       sum (a.invoice_amt)     AS sum_invlice_amt
    ,       sum (a.paid_amt),     AS sum_paid_amt
    ,       b.tot_Amt
    ,       b.inv_amt
    FROM        rec_a          A
    ,        rec_b          B
    WHERE        A.KEY_CODE     = B.KEY_CODE
    AND        B.KEY_CODE      in ('123123')
    group by  B.key_code
    ,            b,tot_amt
    ,       b.inv_amt
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • TO THE FUNCTION SUM WHILE JOINING THREE TABLES

    Hello

    I meet three tables as below in my oracle 9i DB.
    create table ac 
    (account_no varchar2(10),
    bal number)
    
    
    create table c
    (cid number,
    aid number,
    cname varchar2(50)
    )
    
    create table mu
    (ms number,
    BILLING_ACC_NO varchar2(10),
    aid number,
    cid number)
    and I have examples of data like this
    insert into ac (account_no,bal ) values ('1234',3456);
    insert into ac (account_no,bal ) values ('98767',567);
    insert into ac (account_no,bal ) values ('6754',6789);
    insert into ac (account_no,bal ) values ('54678',9453);
    
    insert into c (cid,aid,cname ) values (231,5050,'asdf');
    insert into c (cid,aid,cname ) values (131,5150,'fghj');
    insert into c (cid,aid,cname ) values (221,5050,'rtyu');
    insert into c (cid,aid,cname ) values (931,5151,'asdf');
    
    
    insert into MU (cid,aid,BILLING_ACC_NO ,MS) values (231,5050,'1234',987654);
    insert into MU (cid,aid,BILLING_ACC_NO ,MS) values (231,5050,'98767',8987654);
    insert into MU (cid,aid,BILLING_ACC_NO ,MS) values (221,5050,'6754',3434343);
    insert into MU (cid,aid,BILLING_ACC_NO ,MS) values (221,5050,'54678',667799);
    insert into MU (cid,aid,BILLING_ACC_NO ,MS) values (131,5150,'546738',66779933);
    I need the output as below help = 5050 table c.

    >
    c.CID, c.cname, sum (ac.bal)
    231, asdf, (3456 + 567 = 4023)
    221, rtyu, (6789 + 9453 = 16242)
    >

    selected the cid, cname in table c and found the list BILLING_ACC_NO table mu for help 5050 and every cid after found the sum (bal) for all these account_no (BILLING_ACC_NO MU).

    CID 231 cname asdf is to have BILLING_ACC_NO listed as 1234, 98767 and for these account_no in the ac table ball are 3 456 567 so its sum is needed.

    hope I explained it clearly.

    pls help me to get there.

    SELECT c.cid,
    c.CNAME,
    RTrim (regexp_replace (xmlagg (xmlelement (e, ac.bal |)))) ','))
    . Extract ('//Text ()'),
    ',',
    '+'),
    '+') || '=' || Sum (AC.bal)
    C, mu, ac
    WHERE mu.cid = c.cid
    AND mu.aid = c.aid
    AND account_no = mu.billing_acc_no
    GROUP OF c.cid, c.cname;

  • Pivot - sum with two Tables

    I try to use Pivot by joining with another table, but I am getting an error. I created a few generic test charts and data.
    CREATE TABLE Employee
    (
       empno         NUMBER (3) NOT NULL,                           -- Employee ID
       ename         VARCHAR2 (10 BYTE),                          -- Employee Name
       hireDate      DATE,                                  -- Date Employee Hired
       orig_salary   NUMBER (8, 2),                              -- Orignal Salary
       deptno        NUMBER                              -- Region where employeed
    )
    
    CREATE TABLE departments (deptno   NUMBER, dept_name VARCHAR2 (30))
    SET DEFINE OFF;
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (108, 'Jode', TO_DATE('09/17/1996 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21000, 30);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (122, 'Alison', TO_DATE('09/17/1996 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 45000, 10);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (123, 'James', TO_DATE('12/12/1978 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23000, 20);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (104, 'Celia', TO_DATE('12/12/1978 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 53000, 30);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (105, 'Robert', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 31000, 10);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (116, 'Linda', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 43000, 20);
    Insert into EMPLOYEE
       (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO)
     Values
       (117, 'David', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 78000, 30);
    COMMIT;
    
    SET DEFINE OFF;
    Insert into DEPARTMENTS
       (DEPTNO, DEPT_NAME)
     Values
       (10, 'Maths');
    Insert into DEPARTMENTS
       (DEPTNO, DEPT_NAME)
     Values
       (20, 'Physics');
    Insert into DEPARTMENTS
       (DEPTNO, DEPT_NAME)
     Values
       (30, 'Chemistry');
    COMMIT;
    I'm looking to find the sum of the salaries of all employees by each Department, but organized by date of hire. The output should be something like...
     HIREDATE     Maths    Physics  Chemistry
    
    9/17/1996      45000        0          21000
    1/15/1984      31000     43000   78000
    12/12/1978       0        23000   53000    
    Help with the query is very much appreciated.

    Published by: IamAby on Sep 18, 2012 11:44

    Published by: IamAby on Sep 18, 2012 11:46

    What:

    SQL> select e.hiredate
      2  ,      sum( case when d.dept_name = 'Maths' then orig_salary else 0 end ) maths
      3  ,      sum( case when d.dept_name = 'Physics' then orig_salary else 0 end ) physics
      4  ,      sum( case when d.dept_name = 'Chemistry' then orig_salary else 0 end ) chemistry
      5  from   employee e
      6  ,      departments d
      7  where  d.deptno = e.deptno
      8  group by e.hiredate
      9  order by e.hiredate desc;
    
    HIREDATE                 MATHS    PHYSICS  CHEMISTRY
    ------------------- ---------- ---------- ----------
    17-09-1996 00:00:00      45000          0      21000
    15-01-1984 00:00:00      31000      43000      78000
    12-12-1978 00:00:00          0      23000      53000
    

    Published by: Hoek on September 18, 2012 21:03 added "0 otherwise ' in case '.

  • Joining tables with the aggregate function

    I have 4 tables and I joined and I got my output variables. Joiner_1
    I have another table and I used joiner_1 fields to match this table and had joiner_2. Then, I used aggregator on joiner_2 to get the sum and max values.

    I traced all my outputs of the target of joiner_1 table. and 2 fields I got in Joiner_2 I have them at home to the target table, but it gives me error saying:

    API8003: The attributes of the connection target group is already connected to a source of incompatible data. Use Carpenter or fixed operator to join the data upstream first before plugging it in this operator.

    How to do this.

    Basically, what I'm trying to do is.

    example my target table has 10 fields

    I get 8 fields by adhering to a set of tables, 2 other fields I need to get another table by matching the two my first join of output fields.

    If my first join returns 8 rows for each row, it returns I could have several lines in the table of another that I need to get the money and put it in my table of objectives for the other 2 fields. My target table should be 8 rows after this is all done.

    If I join my table another one at my first joints I get more lines.

    Thanks in advance.

    Hello

    Try this,

    After the 4th Carpenter, I assume you have all three fields in there.

    Add to your aggregator it and use a fith Carpenter and join the 4th and fifth Carpenter

    you would have all three fields and the field of the aggregator

    Then try to complete the objective.

    If this does not work please let me know.

    Published by: Dinesh.Sharma on June 8, 2009 09:31

    Published by: Dinesh.Sharma on June 8, 2009 09:32

  • Sum() on several Tables

    Hello:

    I have 2 tables that have the same column name and I would like to take a NAP on them.
    SELECT sum(norm) as col1, sum(pre) as col2, sum(norm)+sum(pre) as col3
    FROM mv_traffic inner join temp_traffic
    ON temp_traffic.id = mv_traffic.id 
    Is this possible in a single query?

    Sorry Bino, I misunderstood you try this instead...

    SELECT SUM(sum_norm),
                SUM(sum_pre)
    FROM
    (
    SELECT SUM(pre)   sum_pre,
               SUM(norm) sum_norm
    FROM mv_traffic
    UNION ALL
    SELECT SUM(pre) sum_pre,
               SUM(norm) sum_norm
    FROM temp_traffic
    )
    

    Let me know how you go

    See you soon

    Ben

    Published by: Munky on April 15, 2009 14:28

  • Join table JavaScript QML

    It seems that forcing a string table, indicates that he has the correct content, but just .comes (', ') does not work.  -What is that supposed to work in QML?  Is there something else that replaces it?

    I have the code following, that I create, push my navstack, and then call the newParticipant Member:

    {Page}
    [participants varying property:]

    function newParticipant (fn) {}
    This.participants += [fn];
    participantLabel.text = "with:" + this.participants.join (','); "."
    }

    {Label
    ID: participantLabel

    text: "with:
    textStyle {}
    Base: SystemDefaults.TextStyles.SubtitleText
    }
    verticalAlignment: VerticalAlignment.Center
    Multiline: true
    }
    }

    Turns, QML (v4) properties are not true pictures of JavaScript, but kind of pretending to be.  They cannot be transferred.  The solution is:

    var tmp = good;

    tmp.push (a);

    property = tmp;

  • 3 left outer join tables

    Hi all

    I have 3 tables A, B, C

    Create table a (varchar2 (100)) of the currency;

    insert into a values (GBp);

    insert into a values (GBP);

    insert into a values (GBX);

    Create table B (varchar2 (100) currency, number);

    insert into B values (GBP, 61.1);

    Create a table (minor_currency varchar2 (100), major_currency varchar2 (100));

    insert into values of C (GBp, GBP);

    insert into values of C (GBX, GBP);

    I need to get the rate table B by linking the A with the currency as a condition of joining.  (left outer join)

    For currencies which are not in table B, table should be attached with C minor currency-based

    and get the major_currency and join with table B

    Ex:

    something like this:

    Select B.rate from A, B, C

    WHERE (A.currency = B.currency or (A.currency = C.minor_currency and B.currency = C.major_currency)

    O/P: for GBp and GBX currency, I need to get the rate as 61.1 in table B, but B currency is GBP. So I need to get the major_currecny for GBp, GBX table C and join with the table B

    Thank you

    Sasi

    Hi all

    Thanks for your time. Its done

  • Question about the order of evaluation of the clause WHERE CLAUSE when the Oracle OF the syntax used to join tables

    Hello

    Oracle version: 11.1.0.7.0 - 64 bit

    I read the documentation online at joins. The page is avialable here: joins at

    My question is about the join order of evaluation of the conditions in clause and the conditions of those

    are not the join conditions and are placed in the WHERE clause.

    Consider the following pseudocode

    SELECT

    T1. Col1,

    T2.Col1

    Of

    Table1 t1 LEFT OUTER JOIN table2 t2

    WE

    (condition_expression1)

    WHERE

    (condition_expression2)

    Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article?

    Thanks in advance,

    Hello

    dariyoosh wrote:

    Hello

    Oracle version: 11.1.0.7.0 - 64 bit

    I read the documentation online at joins. The page is avialable here: joins at

    My question is about the join order of evaluation of the conditions in clause and the conditions of those

    are not the join conditions and are placed in the WHERE clause.

    Consider the following pseudocode

    SELECT

    T1. Col1,

    T2.Col1

    Of

    Table1 t1 LEFT OUTER JOIN table2 t2

    WE

    (condition_expression1)

    WHERE

    (condition_expression2)

    Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article? ...

    The reverse is actually closer to the truth, but we can't really make general statements like that.

    SQL is not a language of the proceedings.  Looking at the code SQL, we could say that the code does, but we cannot say much about how that code it.  In other words, SQL is a language that describes the results you get, not the way to get them.

    The optimizer will do everything what he thinks is faster if it does not change the results.  If any order in which they are applied (in outer joins or CONNECT BY queries, for example), then think of the join is done first, and the value of the WHERE clause is applied to the result of the join.

    Here is a query looks very much like you posted:

    SELECT d.deptno

    e.ename, e.sal

    OF scott.dept d

    LEFT OUTER JOIN scott.emp e ON e.deptno = d.deptno

    WHERE e.sal > = 3000

    ORDER BY d.deptno

    ;

    Output:

    DEPTNO ENAME SAL

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

    10 KING 5000

    20 FORD 3000

    20 3000 SCOTT

    The scott.dept table contains deptnos 30 and 40; Why are they not in the result set?  The query behaves as if the outer join is made first (production 15 rows), then the WHERE clause has been applied.  All lines with deptno = 30 had sals down han 3000 and all single line with deptno = 40 was NULL in the sal column, then these lines are excluded (as well as other lines of deptnos 10 and 20), and only 3 lines above are left.

  • Just looking for best way to do... 2 data joined tables

    looking for advice this.

    using oracle 11 g.

    I have data im going to use in a view to update TABLE1 monthly.im going to see all these data via php in a web page.

    I would like to add a few modifiable of table2 values who will join table1.

    -drop the table1 table:

    create table table1)

    number of value1,

    Number of value2,

    number of value3,

    Number of VALUE4,

    number of Value5

    );

    INSERT INTO TABLE1 (VALUE1, VALUE2, VALUE3, VALUE4, VALUE5) VALUES (1119,4,54,772,643);

    INSERT INTO TABLE1 (VALUE1, VALUE2, VALUE3, VALUE4, VALUE5) VALUES (22,345,55,278,446);

    INSERT INTO TABLE1 (VALUE1, VALUE2, VALUE3, VALUE4, VALUE5) VALUES (314,193,75,542,676);

    INSERT INTO TABLE1 (VALUE1, VALUE2, VALUE3, VALUE4, VALUE5) VALUES (13,396,59,232,670);

    INSERT INTO TABLE1 (VALUE1, VALUE2, VALUE3, VALUE4, VALUE5) VALUES (41,2003,505,232,7096);

    -select * from table1

    create the table2 table)

    VCLE NUMBER,

    NUMBER OF VERSION_NUM,

    COMMENTAIRES1 VARCHAR2 (50).

    comments2 varchar2 (50)

    );

    -select * from table2

    Vcle in table2 is a concatenation of value1, value2, value3 on table1.

    So the end result is on the web page of all the values in table 1, unmodifiable, 2 reviews in table2 fields that can be changed. A user can change these fields, then they will save in table2 with the key of concatenation. the reason why I want to do like this, with a second table is because whenever a user changes these fields I want to insert again to occur in this table, not an update, which will add a trigger, I have a new version number. This sounds like a mistake to do it this way?

    The strategy of the concatenation is a mistake.

    Concatenation requires strings, then you would be conversion 3 numbers to strings to concatenate, then convert it to a number stored in table2.

    If I insert = 11-v1, v2 = 11, v3 = 11 then insert v1 = 1, v2 = 11, v3 = 111.  I generates the same Vcle and either corrupt your data or make it impossible to tell what row in table1 = 111111 Vcle should concern.

    A substitution used as primary key in table 1 key is a way to fix this design.

Maybe you are looking for

  • Screen time

    I have a g motorcycle, and I can't do more then 4,30 hours with wifi and 3,20 hours with 3g screen. Is it normal? I read that g motorcycle can go up to 6-7 hours of projection on. Thanks for the reply, Sorry for my bad English, I'm Italian.

  • How to block BITTORRENT using ASA5505

    Hello Experts, I need a help. In my network I have an ASA5505 operating with several ACL for many other purposes. It is possible to block data transmission BITTORRENT uses only ASA5505? Or do I need to have any other firewall/software with ASA5505 bl

  • Recording capacity for ASA firewall using ASA-SSM-20 IPS module.

    Hello Please could someone give some tips on how to get the ASA-SSM-20 to record information about something like Kiwi Syslog services etc. We just need to get the IPS alerts to generate the SMS/email feature to alert the various intervention teams.

  • HP Pavilion Sleekbook15-BOO3TU: laptop can't open

    HP Pavilion Sleekbook15 BOO3TU Boot device not found   Please install an operating system on your hard drive. hard drive (3f0) the F2 System Diagnostics   For more information, please visit: www.hp.com/go/techcenter/startup Mr President, this is the

  • I have Windows 7 Home Premium and I can't change my wallpaper?

    When I try to set an image for my high drive page message tell me that there is an internal error has occurred! Help please