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 '.

Tags: Database

Similar Questions

  • Main table with two tables of children as part of the ADF

    Hello

    I'm trying to implement single master with two tables in detail using oracle adf framework of Jdev 11.1.1.4.0. I am able to only master / details using the link display but unable to reach the details i.e., nested block child master with nested blocks.

    I created query view object based on the master and two poll objects of the base seen as details. Then, I created two master of first child link and another link for master of the second child. Even in this case in my data controls I see two different components which is incorrect.

    Please let me know how to create a data control for an example below:
    Fruit [MASTER]
    -Details of Fruits such as the table of the adf
    -Apples [FIRST CHILD]
    -Details of the apples as adf table
    -Orange [SECOND CHILD]
    -Details of the Oranges as adf table

    Kind regards
    Amar.

    You need two viewLinks
    Fruit-> apples
    Fruit-> Oranges

    Then, in the data model, you choose the entry of fruit that has:
    Fruit
    |---> Apples

    You stand on the fruit and you shuttle Oranges to be below left to right.

    If you use the HR schema by default, you will see this type of relationship for employees:
    https://blogs.Oracle.com/Shay/entry/master_with_two_details_on_the

  • recursive query with two tables

    Hello

    Im having problems of recursive query construction and add to select the list to see the result in hierarchical mode, so I want to your advice.

    I have two tables:
    TABLE: t1 
    c_id       parent_id      c_level
    1              -                 1
    2              1                 2
    3              1                 2
    4              -                 1
    5              4                 2
    6              5                 3
    
    TABLE: t2 
    c_id         c_name
    1               name1
    2               name2
    3               name3
    4               name4
    5               name5
    6               name6
    And I want to see the result like this:

    -Name1
    -name2
    -Name3
    -Name4
    -Name5
    -name6

    Could you please help me with this?
    Or maybe can you provide good links where I can find solution how to SELECT LIST looks like the hierarchical tree?

    Here is my test scenario:

    CREATE TABLE t1(
      c_id      NUMBER,
      parent_id NUMBER,
      c_level   NUMBER);
    
    CREATE TABLE t2(
      c_id   NUMBER,
      c_name VARCHAR2(10));
    
    INSERT INTO t1 VALUEs(1,NULL,1);
    INSERT INTO t1 VALUEs(2,1,   2);
    INSERT INTO t1 VALUEs(3,1,   2);
    INSERT INTO t1 VALUEs(4,NULL,1);
    INSERT INTO t1 VALUEs(5,4,   2);
    INSERT INTO t1 VALUEs(6,5,   3);
    
    INSERT INTO t2 VALUEs(1,'name1');
    INSERT INTO t2 VALUEs(2,'name2');
    INSERT INTO t2 VALUEs(3,'name3');
    INSERT INTO t2 VALUEs(4,'name4');
    INSERT INTO t2 VALUEs(5,'name5');
    INSERT INTO t2 VALUEs(6,'name6');
    
    SELECT LPAD('-',2 * a.c_level,'-') || b.c_name the_tree
      FROM t1 a,
           t2 b
     WHERE b.c_id = a.c_id
    CONNECT BY a.parent_id = PRIOR a.c_id
     START WITH a.parent_id IS NULL;
    

    and the result:

    THE_TREE
    ----------
    --name1
    ----name2
    ----name3
    --name4
    ----name5
    ------name6
    

    I took the example you gave then perhaps your largest data set has the flaw?

    Published by: SunDogCa on August 13, 2010 14:19

  • AF:panelStretchLayout with two tables

    I read the layout guides, but I can't still manage to find a solution ot my problem.
    I have the following scenario:

    I have a radio button and two tables, changing the value of the radio button hides the first table and shows the second and vice versa.
    I would like the table to be stretched.

    Lookd page something like this:
    <af:panelBox id="pb1">
         <f:facet name="toolbar">
              <af:toolbar id="t2">
                ...
              </af:toolbar>
         </f:facet>
         <af:panelStretchLayout id="psl1" topHeight="200px" startWidth="auto"
                                       bottomHeight="0px" endWidth="0px">
          <f:facet name="top">
                <af:selectOneRadio id="sor1" value="1"
                                                           autoSubmit="true"
                                                           binding="#{printAnaliticExcelBean.rg}"
                                                           valueChangeListener="#{printAnaliticExcelBean.onRadioChange}">
                                              <af:selectItem 
                                                             value="1" id="r_b1"/>
                                              <af:selectItem 
                                                             value="2" id="r_b124"/>
                </af:selectOneRadio>
           </f:facet>
           <f:facet name="center">
                 <af:panelCollection id="pc1"
                                                partialTriggers="::sor1"
                                                visible="#{printAnaliticExcelBean.rg.value == '1'}">
                               <af:table id="t1">
                                ....
                               </af:table>
                 </af:panelCollection>
                 <af:panelCollection id="pc2"
                                                partialTriggers="::sor1"
                                                visible="#{printAnaliticExcelBean.rg.value == '2'}">
                               <af:table id="t2">
                                ....
                               </af:table>
                 </af:panelCollection>
          </f:facet>
    </af:panelStretchLayout>
    I guess that the af: panelCollection-s must be in another container, but I can't understand that.
    I tried to make two tables in the same panel collection, but the second table was not made for a few reasons.
    I alstried placing the second table in the facet 'start' and affecting the startWidth af:panleStretchLayout = 'auto', but the stretch was not enough.


    Any suggestions?

    Edited by: Valhery 2009-11-26 07:42

    Edited by: Valhery 2009-11-26 07:43

    Edited by: Valhery 2009-11-26 07:43

    Hi Valhery,

    I have an idea, not the time to give it a try, I have to go to bed... > _

    (1) try setting the @rendered instead of setting the @visible attribute.
    If 1) does not.
    (2) try to put the two under a ex:







    It may be useful

    Todd

  • Update a query with two tables

    CREATE TABLE T1
    (
    FIELD1 VARCHAR2 (10),
    VALUE1 INTEGER,
    FIELD2 VARCHAR2 (10),
    INTEGER VALUE2
    )

    INSERT INTO T1 VALUES('OLD',100,'NEW',1000);
    INSERT INTO T1 VALUES('OLD',200,'NEW',2000);
    INSERT INTO T1 VALUES('OLD',300,'NEW',3000);

    CREATE TABLE T2
    (
    DOMAIN VARCHAR2 (10),
    AN INTEGER VALUE,
    NAM VARCHAR2 (10)
    )
    INSERT INTO T2 VALUES('OLD',100,'ABC');
    INSERT INTO T2 VALUES ('OLD', 200', 'ABC');
    INSERT INTO T2 VALUES('OLD',600,'ABC');
    INSERT INTO T2 VALUES('OLD',300,'XYZ');

    There are currently some old values in table T2. But the current requirement is again present corresponding values in table T1 should be taken into account. A condition more is the NAM = 'ABC '.

    I'm writing this way. Is to obtain target updated by several rows from the source. Please help sregard thi.

    T2 UPDATE
    SET A.FIELD = B.FIELD2, A.VALUE = B.VALUE2
    T1 INNER JOIN T2 B
    ON T2. VALUE = T1. VALUE1
    AND T2. NAM = 'ABC '.


    Concerning
    KVB

    You need something more to...

    UPDATE T2 A
    SET (A.FIELD, A.VALUE)=(SELECT B.FIELD2,B.VALUE2
                            FROM   T1 B
                            WHERE  A.VALUE=B.VALUE1)
    WHERE T2.NAM='ABC'
    

    (not tested)

  • CFRETURN with two tables

    Trying two separate structures of Array CFRETURN, but the documentation is not clear on how to proceed.

    Any help would be great.
    Thank you.
    -Christopher Keeler

    You can only return a single object. Put them in a structure



  • Comparing the sum of the two tables and correct by difference of amount in its second t

    Hello guys,.

    I have a very difficult task that I can't get my head around.
    The sample data looks like this:

    Master table
    Request - booking - debit - credit - MasterAmout
    1------------1----------------D---------------------------------15.3
    1------------2----------------D---------------------------------480.6
    1------------3------------------------------C-------------------496.8
    ------------------------------------------- 0.9


    The slave table
    Demande---reservation---debit---credit---slaveamout---slavecorrection
    1------------1------------D------------------------------------15.3---------------14.5
    1------------2------------D------------------------------------480.6-------------480.6
    1------------3-----------------------------C-------------------496---------------496
    -------------------------------------------0.1--------------------------------------0.9


    The reservation have a total amount of 0.1, but must be corrected to 0.9 because the main table has 0.9.

    Reservation 1 requires a correction so the slave table also has a total of 0.9 (business rule is, only corrections on the first booking). So we have
    to change the amount of 15.3 to 14.5. I plan my SQL like this:

    1 reservations sum of two tables for each claim. Compare the two for each individual claim.
    2. If Captain sum the amount shows a difference between master / slave
    2.1 select top 1 table reservation slave for the specific claim and increase/decrease by the difference of these two amounts.

    Who is?

    Hello

    Use MERGE to actually do the UPDATE.
    The ROW_NUMBER analytic function to identify the first booking in slave (unless you can count on which the reservation = 1).

    MERGE INTO     slave     dst
    USING     (
         WITH     master_summary     AS
         (
              SELECT       claim
              ,       SUM ( master_ampount * CASE
                                       WHEN  debit  = 'D'  THEN -1
                                       WHEN  credit = 'C'  THEN  1
                                   END
                         )     AS balance
              FROM       master
              GROUP BY  claim
         )
         SELECT     s.claim
         ,     s.booking
         ,     SUM ( s.slave_amount * CASE
                                WHEN  s.debit  = 'D'  THEN -1
                                WHEN  s.credit = 'C'  THEN  1
                               END
                  ) OVER (PARTITION BY  claim) - m.balance     AS diff
         ,     ROW_NUMBER () OVER ( PARTITION BY  claim
                             ORDER BY        booking
                           )     AS r_num
         FROM     master_summary     m
         JOIN     slave          s  ON     m.claim     = s.claim
         )          src
    ON     (     src.claim     = dst.claim
         AND     src.r_num     = 1
         )
    WHEN MATCHED THEN UPDATE
    SET     dst.debit      = CASE
                        WHEN src.diff      <  0 THEN 'D'
                                       ELSE NULL
                     END
    ,     dst.credit      = CASE
                        WHEN src.diff      <  0 THEN NULL
                                       ELSE 'C'
                     END
    ,     dst.slaveamount = ABS (src.diff)
    ;
    

    If you would care to CREATE TABLE and INSERT statements for the sample data (showing the two tables, as they exist before the DML) then I could test this.

    The design of history seems very uncomfortable. Instead of the debit and credit columns, it would be much simpler to have positive and negative amounts. Is it really worth now both not corrected and corrected the amounts in the table on the slave, especially if you keep only versions corrected debit and credit columns?

  • FGV with two types of variables

    It goes something like this

    I want the FGV having a cluster of two tables 1 d of double (which will be the variable of the FGV). and the data that I am 'Add' is a double issue / constant (whatever), it will be the additional variable.

    the main idea is that I want to be able to choose to which one of the two i added the extra number and I think that it is quite easy to achieve with a simple Boolean control (reference) and the structure of the case, that's what I did.

    the problem is that if I what that it either does not connect the FGV labview shift register does recognize as the FGV variable, that I have just described, and if I do, it's an extra entry which I don't want to use it later.

    in theory, I can do my extra variable to be also a cluster with two tables 1 d of type double, however, given that my entry has a single issue, I do not know how to accomplish it.

    Thanks in advance.

    It would be good to know if something like this is even possible. (first option)


  • Implement conditional read-only column in the set of two Tables

    Hello

    I would like to implement a mechanism of "read-only conditional" on a column in a table with two tables in total to be involved in this situation.

    I have a demo/proof of concept of the present and things work as expected in the tests I've done; However, I would like any input as to if there is a better way, etc.

    This is a far-fetched but demo that illustrates the main ingredients however. Oracle 10.2.0.4 version 64 bit on Windows Server 2008 Release 2 64-bit.

    -Table DDL and small sample data
    create table band(
      band_id   number primary key,
      band_name varchar2(20),
      status    varchar2(20)
    );
    
    create table band_member(
      band_id references band,
      member_name varchar2(20)
    );
    
    insert into band values(3, 'The Rutles', 'prefab4');
    insert into band values(4, 'The Beatles', 'established');
    commit;
    
    insert into band_member values(3, 'Ron Nasty');
    insert into band_member values(3, 'Dirk McQuickly');
    insert into band_member values(3, 'Stig O''Hara');
    insert into band_member values(3, 'Barrington Womble');
    commit;
    
    insert into band_member values(4, 'John Lennon');
    insert into band_member values(4, 'Paul McCartney');
    insert into band_member values(4, 'George Harrison');
    insert into band_member values(4, 'Ringo Starr');
    commit;
    -The rules relating to the conditional objective of read-only

    1 is not allowed to update band.band_name when band.status = 'prefab4'
    2 is not allowed to insert/update / deletion of lines of band_member when the parent a band.status row = 'prefab4'

    -The triggers used to implement the goal (current solution)
    create or replace trigger t1
    before update of band_name on band
    for each row
    when (old.status = 'prefab4' or new.status = 'prefab4')
    begin
      raise_application_error(-20010,
        'can not update band_name when status=''prefab4''');
    end;
    /
    
    create or replace trigger t2
    before insert or update or delete on band_member
    for each row
    declare
      l_status band.status%type;
      l_band_id band_member.band_id%type;
      cursor l_cursor (p_band_id number) is
      select status from band
      where band_id = p_band_id
      for update;
    begin
      if updating or inserting then
        l_band_id := :new.band_id;
      else
        l_band_id := :old.band_id;
      end if;
      open l_cursor(l_band_id);
      fetch l_cursor into l_status;
      close l_cursor;
      if l_status = 'prefab4' then
        raise_application_error(-20011,
          'can not update child when parent status=''prefab4''');
      end if;
    end;
    /
    -Quick example of test for each condition
    update band
    set    band_name = 'THE RUTLES'
    where  band_id = 3;
    
    update band
           *
    ERROR at line 1:
    ORA-20010: can not update band_name when status='prefab4'
    ORA-06512: at "DEMO.T1", line 2
    ORA-04088: error during execution of trigger 'DEMO.T1'
    
    
    update band_member
    set    member_name = 'RON NASTY'
    where  member_name = 'Ron Nasty';
    
    update band_member
           *
    ERROR at line 1:
    ORA-20011: can not update child when parent status='prefab4'
    ORA-06512: at "DEMO.T2", line 18
    ORA-04088: error during execution of trigger 'DEMO.T2'
    As I said, while my simple tests seem to show the correct results, there I was wondering if there could be a better way to implement such functionality.

    I tried to provide the information needed, but if I managed to omit something, please let me know.

    See you soon,.

    Chalfont

    Hi, Chalfont,

    user13146957 wrote:
    ...
    I'm went to the road to slider to add the clause "for update" to force the serialization on the line - i.e. the idea was to avoid the case where another session might want to update the State a moment after my extraction but before the rest of the finished code. Who is?

    No, not really. The trigger on tape prevents anyone else from ever change their status from 'prefab4' to something else (or vice versa).
    Even apart from this, you put some efforts to prevent something which will be allowed a fraction of a second later (or maybe the other way around). What is significant in that split second?

    I didn't think about other ideas rather than the approach of the trigger, but came up empty, somehow, to this day. I am open to resort to others and make some schema changes is not off the table either.

    FGA (Fine grain access), or his brothers and sisters more older VPD (virtual private database) can also do what you want, but instead of trigger an error, they ignore the illegal action. This can be an advantage or a disadvantage, depending on your needs.

    Another approach is for the owner of the table, not to grant INSERT, UPDATE or DELETE privileges to anyone: all DML must be made via a procedure (or procedures) belonging to the owner of the table, which grants EXECUTE privileges instead of other privileges.

  • How to match columns from two tables with

    Hello:
    I have two tables as below:

    Table1::(Base Table)
    Country | Prefix | Prefix_Length
    Travel | 001 | 3
    CountryB. 0012 | 4
    PaysC | 00443 | 5
    CountryD | 0091 | 4

    :(Detail Table) table2
    The population | Area | Prefix
    500 | AreaA | 0015921
    1000 | AreaB | 00122
    400. AreaC. 00443743
    300. ALIS | 0091333
    100. AreaA | 001

    I need to match these two tables with prefix columns (whose length is not fixed in the two tables: but it starts with 00 in the two tables). Two different countries the prefix may be similar up to a certain length. Thus, Prefix_Length can be used to determine (exactly) how much time should be taken in the search of Table2.

    Output:
    Country | Prefix | Area | Population
    Travel | 001 | AreaA | 600
    CountryB. 0012 | AreaB | 1000
    PaysC | 00443 | AreaC. 400
    CountryD | 0091 | ALIS | 300

    Please help me with your valuable comments.

    -Tender

    Try this

    with base_table as (
                        select 'CountryA' country,'001' prefix,3 prefix_length from dual union all
                        select 'CountryB','0012',4 from dual union all
                        select 'CountryC','00443',5 from dual union all
                        select 'CountryD','0091',4 from dual
                       ),
       detail_table as (
                        select 10 no_of_call,'0015921' prefix from dual union all
                        select 3,'00122' from dual union all
                        select 50,'00443743' from dual union all
                      select 50,'00443643' from dual union all
                        select 300,'0091333' from dual union all
                        select 60,'001' from dual
                       ) 
    
    SELECT  country,
            prefix,sum(no_of_call)
       FROM (
             select  country,
            b.prefix,no_of_call,
            decode(no_of_call,lead(no_of_call,1,0) over(partition by no_of_call order by b.prefix,no_of_call),'y','n') y_or_no
      from  base_table b,
            detail_table d
      where b.prefix = substr(d.prefix,1,prefix_length))
      where y_or_no !='y'
      group by  country,
            prefix
      order by country,
            prefix;
    

    Published by: Vi on 20 February 2012 01:07

  • by comparing the two tables with

    With the help of 10 gr 2

    Assuming that we have two tables with the following structure:
    create table1 (integer id, amount1 number, status varchar2 (200));
    create table2 (integer id, number, status varchar2 amount2 (200));

    Table1 contains a single line:
    ID = 4711, amount1 = 3, status = "not ok".

    Table2 contains one or more lines with table2.id = table1.my_field referenced:
    ID = 4711, amount2 = 2, status = "not ok".
    ID = 4711, amount2 = 2, status = "not ok".
    ID = 4711, amount2 = 1, status = "not ok".
    ID = 4711, amount2 = 4, status = "not ok".

    The amount1 in Table1 is a cumulative sum of Table2 lines what status should be set to "ok". Table1.my_field is particularly well indexed.

    How to make all the lines (for example via the rowid) from Table2 that sum on amount2 is the amount1 in the line after line in Table1 (for switching their table2.status to 'ok')?
    I hope my question is clear enough...

    Try this

     SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 Ok
          4711          2 not ok
          4711          1 Ok
          4711          4 not ok
    
    SQL> roll
    Rollback complete.
    SQL> select * from table1;
    
            ID    AMOUNT1 STATUS
    ---------- ---------- ------
          4711          3 not ok
    
    SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 not ok
          4711          2 not ok
          4711          1 not ok
          4711          4 not ok
    
    SQL>
    SQL>
    SQL> update
      2     table2 a
      3  set
      4     a.status = 'Ok'
      5  where
      6     rowid in
      7       (select t2.rowid
      8       from
      9             (select
     10                     table2.*,
     11                     sum(amount2) over (partition by id order by rn) rn_total
     12             from
     13                     (select table2.*, row_number() over (partition by id order by amount2) rn from  table2 ) table2)  t2,
     14             table1
     15        where
     16             table1.id = t2.id and
     17             t2.rn_total <= table1.amount1)
     18  /
    
    2 rows updated.
    
    SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 Ok
          4711          2 not ok
          4711          1 Ok
          4711          4 not ok
    
    SQL>
    
  • compare two table with cluster inside

    Hello

    I want to compare two tables containing a cluster with several groups in it. When you use the equal the result is the same pattern as the cluster of entry. But I just need a true or false. It doesn't bother me that it changed on position 1 or any other position.

    Is there an elegant way to do it?

    Thanks for any help.

    Yves

    Right-click equality and change to compare aggregations. That, or add a table and later.

    /Y

  • I want to put two tables on a page with two columns how can I do this?

    I want to put two tables on a page with two columns how can I do this?

    It depends on what application you are using.

    If you use Word, then a good way would be to create a single table of 5 columns, check the borders of the invisible middle column so that it appears to be two separate tables.  You will need to do the same thing for unused cells downstairs as well.

    To get the best advice on Office-Word questions, use the forum not the Windows 7 Office forum that you do.  Look at the top of this page, just below the logo MS Answers and click on Forums , then select desktop. Once there, you can select Word.  By using the forum Office will give you a better chance to find a solution to your problem, as it is inhabited by people who know much about their topic.  Search the Forum of office for the topic, then, if no notice is found, ask your question here instead of this.

  • How the sum of these two tables?

    Hello

    I have two tables

    DESC ACTIVITE_EXCEP_FAITE

    NUMBER OF FICHE_ID

    NUMBER OF SERVICES_ID

    NUMBER OF ACTIVITES_EXCEPTIONNELLES_ID

    NUMBER OF TIME

    NUMBER OF ACTIVITE_EXCEP_FAITE_ID

    DESC ACTIVITE_FAITE

    NUMBER OF FICHE_ID

    NUMBER OF ACTIVITES_ID

    NUMBER OF SECTEURS_ID

    LENGTH NUMBER (8.2)

    NUMBER OF ACTIVITE_FAITE_ID

    NUMBER OF TYPE_ACTIVITE_ID

    I want to add the column to the DURATION of the two tables when they get the same FICHE_ID. FICHE_ID is not a join field.

    I've tried this application, but it gives result when two recordings of the two table share the same number FICHE_ID.

    SELECT AF. FICHE_ID, SUM (NVL (AF. LENGTH, 0)) + SUM (NVL (AEF. LENGTH, 0))

    OF AF, ACTIVITE_EXCEP_FAITE AEF ACTIVITE_FAITE

    WHERE AF. FICHE_ID = AEF. FICHE_ID

    GROUP BY AF. FICHE_ID;

    Can you help me write this selection?

    Thank you very much for your help!

    Like this?

    select nvl(af.fiche_id, aef.fiche_id) fiche_id
         , sum(nvl(af.duree,0)) + sum(nvl(aef.duree,0)) duree
      from activite_faite af
      full join
           activite_excep_faite aef
        on af.fiche_id = aef.fiche_id
     group by nvl(af.fiche_id, aef.fiche_id);
    
  • How to link two tables with a part of a cell value

    I have 1 column, which contains info like this "1 to 4 numbers - two words" in tableA

    for example

    985 - train series

    14 baby Doll

    874 piano keyboard

    6 - DVD player

    etc.

    In table B I have columns with the numbers of toys 1 and 2 which has the price.

    I want to write a query that gives me the number, name and price.

    But I don't know how to link part of the value in a cell with another table.

    I know that the database is not normalized, but I did not design and I have no permission to change.

    Kind regards

    What have you tried?

    Please read: Re: 2. How can I ask a question on the forums?

    Sounds to me like you just want to join the tables on a partial string, so to make you just extract the numbers from the table A Column1.

    for example

    TO_NUMBER (substr (A.col1, 1, instr(' ')-1))

Maybe you are looking for

  • Bluetooth / pc not supported

    my ipod touch 4th generation does not connect to my pc windows 10, even if it connects to my car bluetooth.  can anyone help. ?

  • Qosmio G20 and Acronis True Image

    Hello I have a G20 with the media library and twin 100 GB hard disks that are configured to act as two separate discs (set up of RAID options when I reinstalled the system). I have programs on a disk (C) and the operating system and my data on the ot

  • How to unlock a Firefox plugin has disabled "for my protection?"

    I want to use the plugin QuickTime for Firefox, but version 7.1 is blocked, and version 7.2 does not support Windows 2000. I'm fine with the performer 7.1; the risk is very low, and I'm willing to accept it. Or someone has another solution?

  • How to change password email, cannot get the email account

    GI rlfreind change password, can not get into my account. need to change the account password for this * address email is removed from the privacy * can receive information on my * address email is removed from the privacy * box * original title - ho

  • What happens with update with new min OS?

    I have an application on BlackBerry World & want to know what happens when I submit an update. More precisely: the current version of my app has a minimum OS of 10.2. If I introduce a new version and select a minimum OS of 10.3.1 users with older ver