How to correctly perform a join to get the desired output

Hi,
I have the following query which gives me the desired output.
SELECT
Cast(TEDW_F_STORE_OPS_GOAL.LOCATION_NUM As Varchar) As LOCATION_NUM,
Cast(TEDW_D_DATE_TYPE_1.DATE_SHORT As Varchar) As DATE_SHORT,
'Store' As DRIVER_TYPE,
'OPS GOAL' As DRIVER,
SUM(OPS_GOAL) As ROW_TOTAL
FROM Planning.TEDW_F_STORE_OPS_GOAL
left outer join
edw.Calendar.TEDW_D_DATE_TYPE_1
ON TEDW_F_STORE_OPS_GOAL.DATE_KEY = TEDW_D_DATE_TYPE_1.DATE_KEY
left outer join
[EDW].[Location].[TEDW_D_LOCATION_TYPE_1_NEW]
ON TEDW_F_STORE_OPS_GOAL.LOCATION_NUM = TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_NUM
where TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_TYPE_DESC = 'FULL PRICE STORE'
group by
TEDW_F_STORE_OPS_GOAL.LOCATION_NUM,
TEDW_D_DATE_TYPE_1.DATE_SHORT
order by LOCATION_NUM desc
, DATE_SHORT desc
The output of the above query will be like this
3646 2014-04-17 Store OPS GOAL 2598.00000
3646 2014-04-16 Store OPS GOAL 2475.00000
3646 2014-04-15 Store OPS GOAL 2497.00000
3646 2014-04-14 Store OPS GOAL 2691.00000
But the problem with this query is it brings back the OPS Goal for all the dates,but i have to limit the OPS goals to some particular date range which must match to this table Staging.TEDW_S_EMPOWER.So,I made the above query join to this table like this
SELECT
Cast(TEDW_F_STORE_OPS_GOAL.LOCATION_NUM As Varchar) As LOCATION_NUM,
Cast(TEDW_D_DATE_TYPE_1.DATE_SHORT As Varchar) As DATE_SHORT,
'Store' As DRIVER_TYPE,
'OPS GOAL' As DRIVER,
SUM(OPS_GOAL) As ROW_TOTAL
FROM Planning.TEDW_F_STORE_OPS_GOAL
left outer join
edw.Calendar.TEDW_D_DATE_TYPE_1
ON TEDW_F_STORE_OPS_GOAL.DATE_KEY = TEDW_D_DATE_TYPE_1.DATE_KEY
left outer join
[EDW].[Location].[TEDW_D_LOCATION_TYPE_1_NEW]
ON TEDW_F_STORE_OPS_GOAL.LOCATION_NUM = TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_NUM
left outer join
Staging.TEDW_S_EMPOWER
on TEDW_D_DATE_TYPE_1.DATE_SHORT = TEDW_S_EMPOWER.DATE_SHORT
and TEDW_F_STORE_OPS_GOAL.LOCATION_NUM = TEDW_S_EMPOWER.LOCATION_NUM
where TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_TYPE_DESC = 'FULL PRICE STORE'
group by
TEDW_F_STORE_OPS_GOAL.LOCATION_NUM,
TEDW_D_DATE_TYPE_1.DATE_SHORT
having TEDW_D_DATE_TYPE_1.DATE_SHORT between MIN(TEDW_S_EMPOWER.date_short) and MAX(TEDW_S_EMPOWER.date_short)
order by LOCATION_NUM desc
, DATE_SHORT desc
Now the output of this query will be like this
3646 2014-04-17 Store OPS GOAL 7794.00000
3646 2014-04-16 Store OPS GOAL 7425.00000
3646 2014-04-15 Store OPS GOAL 7491.00000
3646 2014-04-14 Store OPS GOAL 8073.00000
If you can observe the OPS Goal Sum values have changed drastically, i was able to limit the date range i wanted but now i dont get the correct OPS Goal values.
Can someone please help me with this?
Thanks

Hi RJP,
Yes you are absolutely correct, in the "Staging.TEDW_S_EMPOWER"
we have 3 rows for every date and location,so i changed my second sql to be something like this
SELECT
Cast(TEDW_F_STORE_OPS_GOAL.LOCATION_NUM As Varchar) As LOCATION_NUM,
Cast(TEDW_D_DATE_TYPE_1.DATE_SHORT As Varchar) As DATE_SHORT,
'Store' As DRIVER_TYPE,
'OPS GOAL' As DRIVER,
SUM(OPS_GOAL) /3 As ROW_TOTAL
FROM Planning.TEDW_F_STORE_OPS_GOAL
cross join
EDW.Utility.TEDW_J_PROCESS_DATE
inner join
edw.Calendar.TEDW_D_DATE_TYPE_1
ON TEDW_F_STORE_OPS_GOAL.DATE_KEY = TEDW_D_DATE_TYPE_1.DATE_KEY
left outer join
[EDW].[Location].[TEDW_D_LOCATION_TYPE_1_NEW]
ON TEDW_F_STORE_OPS_GOAL.LOCATION_NUM = TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_NUM
left outer join
Staging.TEDW_S_EMPOWER
on TEDW_D_DATE_TYPE_1.DATE_SHORT = TEDW_S_EMPOWER.DATE_SHORT
and TEDW_F_STORE_OPS_GOAL.LOCATION_NUM = TEDW_S_EMPOWER.LOCATION_NUM
where TEDW_D_LOCATION_TYPE_1_NEW.LOCATION_TYPE_DESC = 'FULL PRICE STORE'
group by
TEDW_F_STORE_OPS_GOAL.LOCATION_NUM,
TEDW_D_DATE_TYPE_1.DATE_SHORT
having TEDW_D_DATE_TYPE_1.DATE_SHORT between MIN(TEDW_S_EMPOWER.date_short) and MAX(TEDW_S_EMPOWER.date_short)
order by LOCATION_NUM desc
, DATE_SHORT desc
Now i receive the correct values as i am doing divided
by 3,but may be in the future the empower tablemay have more than 3 ,is there any other effective way i can do this?
below is the sample query and sample data from empower table.
select * from Staging.TEDW_S_EMPOWER
where DATE_SHORT = '2014-04-17'
and LOCATION_NUM = 3020
DRIVER_TYPE DRIVER DATE_SHORT
store Sales 2014-04-17
store Transactions 2014-04-17
store Traffic 2014-04-17
Thanks

Similar Messages

  • How to modify this query to get the desired output format

    I hv written a Query to display all the parent table names and their primary key columns(relevant to this foreign key of the child table).The query is given below...
    SELECT DISTINCT(TABLE_NAME) AS PARENT_TABLE,COLUMN_NAME AS PARENT_COLUMN
    FROM ALL_CONS_COLUMNS
    WHERE CONSTRAINT_NAME IN (SELECT AC.R_CONSTRAINT_NAME
    FROM ALL_CONSTRAINTS AC
    WHERE AC.TABLE_NAME=TABLE_NAME
    AND AC.TABLE_NAME='&TABLE'
    AND AC.R_CONSTRAINT_NAME IS NOT NULL);
    This query will display all the parent tables and their primary key columns.Now my problem is that how to modify this query to also display the foreign key column name of the child table.
    I want the query result in the following format.The query should display the following columns.1)child table's name,2)child table's foreign key column name,3)the corresponding parent table's name,4)the parent table's primary key column name(which is the foreign key in the child table).
    For Example I want the output as follows...
    TAKE THE CASE OF SCOTT.EMP(AS INPUT TO YOUR QUERY)
    CHILD_TABLE CHILD_COLUMN PARENT_TABLE PARENT_COLUMN
    EMP DEPTNO DEPT DEPTNO
    In this result I hv used alias name for the columns.The query should display this only for the foreign keys in the child table.In the query which I sent to you earlier will give the parent table and the parent column names,But I also want to append the child table and child column names there.
    any help on how to tackle would be appreciated.

    Try this query
    SELECT c.table_name child_table,
         c.column_name child_column,
         p.table_name parent_table,
         p.column_name parent_column
    FROM user_constraints a,user_constraints b,user_cons_columns c,
         user_cons_columns p
    WHERE a.r_constraint_name=b.constraint_name and
          a.constraint_name=c.constraint_name and
          b.constraint_name=p.constraint_name and
          c.position=p.position
    ORDER BY c.constraint_name,c.position
    Anwar

  • How to get the desired output in the format ...?

    Hi all,
    I am having data like this.
    Col1 col2 col3
    1 2 1
    1 2 2
    1 2 3
    2 3 7
    2 3 8
    2 3 9
    I want to output the data like this
    1 2 1,2,3
    2 3 7,8,9
    How to get this.
    Thanks in advance,
    Pal

    In simple sql...
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from t
      2  /
          COL1       COL2       COL3
             1          2          1
             1          2          2
             1          2          3
             2          3          7
             2          3          8
             2          3          9
    6 rows selected.
    SQL> select max(decode(rno,1,to_number(col1||col2||col3))) col1, max(decode(rno,2,col3)) col2, max(decode(rno,3,col3)) col3
      2    from (select row_number() over(partition by col1,col2 order by col3) rno, t.*
      3           from t)
      4  group by col1
      5  /
          COL1       COL2       COL3
           121          2          3
           237          8          9
    SQL>Thanks,
    Karthick.

  • How to get the desired output

    My Table Data
    ContractID     MaterialGroup      CommodityCode     Amount
    C123       Travel     200     100
    C123      Travel     201     100
    C123             Travel     203     100
    C124            Stationery     315     500
    C126            Travel             200     600
    C126            Admin             413     600
    My expected output
    ContractID     MaterialGroup      CommodityCode     Amount
    C123        Travel             200|201|203     100
    C124             Stationery             315                     500
    C126            Travel|Admin     200|413           600
    My Present Output
    CONTRACTID MATERIALGROUP    COMMODITYCODE AMOUNT
    C123            Travel|Travel|Travel  200|203|201        100
    C124            Stationery               315                     500
    C126            Travel|Admin           200|413               600
    My Query:
      SELECT ContractID,
      RTrim(
                  xmlagg(
                          xmlelement(e, MaterialGroup|| '|')).extract('//text()'),'|') MaterialGroup,
      RTrim(
                  xmlagg(
                          xmlelement(e, CommodityCode|| '|')).extract('//text()'),'|') CommodityCode,Amount
    FROM (
    WITH t1 AS (
    SELECT 'C123' ContractID,     'Travel'MaterialGroup,      200     CommodityCode, 100 Amount FROM dual UNION all
    SELECT 'C123',            'Travel',     201,     100 FROM dual UNION all
    SELECT 'C123',            'Travel',     203,     100 FROM dual UNION all
    SELECT 'C124','Stationery',     315,     500 FROM dual UNION all
    SELECT 'C126','Travel',     200,     600 FROM dual UNION all
    SELECT 'C126','Admin',413,     600 FROM dual)
    SELECT * FROM t1)
    GROUP BY ContractID,Amount;

    select t.*,
            case when cdm = 1 and cm > 1
                    then substr(materialgroup,1, instr(materialgroup,'|', cdm)-1)
                    else materialgroup end materialgroup_edit,
             case when cdm = 1 and cm > 1 then mm else materialgroup end materialgroup_edit2
    from
              select contractid,
              count(materialgroup) cm,
              count(distinct materialgroup) cdm,
              max(materialgroup) mm,
              rtrim(
                          xmlagg(
                                  xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') materialgroup,
              rtrim(
                          xmlagg(
                                  xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
            from (
            with t1 as (
            select 'C123' contractid,    'Travel' materialgroup,     200    commoditycode, 100 amount from dual union all
            select 'C123',            'Travel',    201,    100 from dual union all
            select 'C123',            'Travel',    203,    100 from dual union all
            select 'C124','Stationery',    315,    500 from dual union all
            select 'C126','Travel',    200,    600 from dual union all
            select 'C126','Admin',413,    600 from dual  )
            select * from t1)
            group by contractid,amount
            ) t;
    CONTRACTID         CM        CDM MM         MATERIALGROUP        COMMODITYCODE            AMOUNT MATERIALGROUP_EDIT   MATERIALGROUP_EDIT2
    C123                3          1 Travel     Travel|Travel|Travel 200|203|201                 100 Travel               Travel             
    C124                1          1 Stationery Stationery           315                         500 Stationery           Stationery         
    C126                2          2 Travel     Travel|Admin         200|413                     600 Travel|Admin         Travel|Admin       
    3 rows selected.
    select contractid,
              case when count(distinct materialgroup) = 1 and count(materialgroup) > 1 then max(materialgroup)
              else
              rtrim(
                          xmlagg(
                                  xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') end materialgroup,
              rtrim(
                          xmlagg(
                                  xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
            from (
            with t1 as (
            select 'C123' contractid,    'Travel' materialgroup,     200    commoditycode, 100 amount from dual union all
            select 'C123',            'Travel',    201,    100 from dual union all
            select 'C123',            'Travel',    203,    100 from dual union all
            select 'C124','Stationery',    315,    500 from dual union all
            select 'C126','Travel',    200,    600 from dual union all
            select 'C126','Admin',413,    600 from dual  )
            select * from t1)
            group by contractid,amount;
    CONTRACTID MATERIALGROUP        COMMODITYCODE            AMOUNT
    C123       Travel               200|203|201                 100
    C124       Stationery           315                         500
    C126       Travel|Admin         200|413                     600
    3 rows selected.
    with t1 as (
            select 'C123' contractid,    'Travel' materialgroup,     200    commoditycode, 100 amount from dual union all
            select 'C123',            'Travel',    201,    100 from dual union all
            select 'C123',            'Travel',    203,    100 from dual union all
            select 'C124','Stationery',    315,    500 from dual union all
            select 'C126','Travel',    200,    600 from dual union all
            select 'C126','Admin',413,    600 from dual  ),
            t2 as
            select contractid, materialgroup
            from t1
            group by contractid, materialgroup
    select  t1.contractid,
              t2.materialgroup,
              rtrim(
                          xmlagg(
                                  xmlelement(e, commoditycode|| '|')).extract('//text()'),'|') commoditycode,amount
    from t1,
                    select contractid,
                                rtrim(
                                      xmlagg(
                                              xmlelement(e, materialgroup|| '|')).extract('//text()'),'|') materialgroup
                    from t2
                    group by contractid
                    ) t2
    where t1.contractid = t2.contractid
    group by t1.contractid, t2.materialgroup, t1.amount;
    CONTRACTID MATERIALGROUP        COMMODITYCODE            AMOUNT
    C123       Travel               200|203|201                 100
    C124       Stationery           315                         500
    C126       Admin|Travel         200|413                     600
    3 rows selected.

  • How to get the desire output from sql query

    Consider an Order Table: ...
    Order Table:
    Order Id Item Qty
    O1 A1 5
    O2 A2 1
    O3 A3 3
    Please provide SQL which will explode the above data into single unit level records as shown below
    Desired Output:
    Order Id Order Id Qty
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O1 A1 1
    O2 A2 1
    O3 A3 1
    O3 A3 1
    O3 A3 1

    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • GETTING NO ERROR BUT STILL NOT GETTING THE DESIRED OUTPUT!!!!!!!!

    HIII ,
    AM DOING AN APPLICATION IN WHICH I AM TRYING TO INSERT VALUES IN A TABLE(CREATED THRU JAVA DICTIONARY), USING EJBS(ENTITY BEAN AND SESSION BEAN) AND COMMAND BEAN..AND WEBDYNPRO....
    AFTER DEPLOYMENT EVRYTHNG IS RUNNING FINE BUT VALUES NOT GETTING ADDED IN THE TABLE...
    THE CODE FOR THE "ADD" BUTTON IS :
    wdContext.currentEmp_cmdElement().modelObject().add(wdContext.currentEmp_cmdElement().getEmpno(),wdContext.currentEmp_cmdElement().getEmpname());
    THE CODE FOR ADD function IN COMMANDBEAN IS
    public void add(String empno,String empname){
    try {
    local.createdata(empno,empname);
    } catch (Exception e) {
    e.printStackTrace();}
    PLZZ DO HELP OUT!!!

    try { aPreparedStatement.close();
               if(dmd!=null)
                            dmd = null;
               if(con!=null)
                            con.close();
                catch (Exception e)
                     e.printStackTrace();  
                }instead of catching the last error i printed it and it came up with an error of nullPointerException
    for the line of code
    try { aPreparedStatement.close();how can i fix this error please
    and thank you

  • To write a single query to get the desired output.

    Hi,
    I have table by name "employees" it contains 20 records meaning 20 employee details.
    some of the column it contains are employee_id,Hiredate as below.
    EMPLOYEE_ID|HIRE_DATE
    100|6/17/1987
    101|9/21/1989
    102|1/13/1993
    103|1/3/1993
    104|5/21/1991
    107|2/7/1999
    124|11/16/1999
    141|10/17/1995
    142|1/29/1997
    143|3/15/1998
    144|7/9/1998
    149|1/29/2000
    174|5/11/1996
    176|3/24/1998
    178|5/24/1999
    200|9/17/1987
    201|2/17/1996
    202|8/17/1997
    205|6/7/1994
    206|6/7/1994
    The query should display the total number of employees, employees hired in 1995,1996,1997 and 1998 some thing like below.
    output
    Total     1995     1996     1997     1998
    20     1     2     2     3
    please let me know the query.
    Thanks
    Dinesh

    SQL> select * from employees;
             EMPLOYEE_ID HIRE_DATE
                     100 17-JUN-1987 00:00:00
                     101 21-SEP-1989 00:00:00
                     102 13-JAN-1993 00:00:00
                     103 03-JAN-1993 00:00:00
                     104 21-MAY-1991 00:00:00
                     107 07-FEB-1999 00:00:00
                     124 16-NOV-1999 00:00:00
                     141 17-OCT-1995 00:00:00
                     142 29-JAN-1997 00:00:00
                     143 15-MAR-1998 00:00:00
                     144 09-JUL-1998 00:00:00
                     149 29-JAN-2000 00:00:00
                     174 11-MAY-1996 00:00:00
                     176 24-MAR-1998 00:00:00
                     178 24-MAY-1999 00:00:00
                     200 17-SEP-1987 00:00:00
                     201 17-FEB-1996 00:00:00
                     202 17-AUG-1997 00:00:00
                     205 07-JUN-1994 00:00:00
                     206 07-JUN-1994 00:00:00
    20 rows selected.
    SQL> select count(*) total_employees
      2        ,sum(case when to_char(hire_date,'YYYY') = '1995' then 1 else 0 end) hired_1995
      3        ,sum(case when to_char(hire_date,'YYYY') = '1996' then 1 else 0 end) hired_1996
      4        ,sum(case when to_char(hire_date,'YYYY') = '1997' then 1 else 0 end) hired_1997
      5        ,sum(case when to_char(hire_date,'YYYY') = '1998' then 1 else 0 end) hired_1998
      6  from   employees;
         TOTAL_EMPLOYEES           HIRED_1995           HIRED_1996           HIRED_1997           HIRED_1998
                      20                    1                    2                    2                    3Edited by: SomeoneElse on Jan 6, 2009 8:09 AM

  • Getting the desired Output

    Hi ALl,
    I have a table as Listed below.
    SQL> CREATE  TABLE T1 (c1 varchar2(10),c2 varchar2(10),c3 varchar2(10), c4 var
    ar2(10),audit1 number);
    Table created.
    SQL> DESC T1
    Name                                      Null?    Type
    C1                                                 VARCHAR2(10)
    C2                                                 VARCHAR2(10)
    C3                                                 VARCHAR2(10)
    C4                                                 VARCHAR2(10)
    AUDIT1                                             NUMBER
    SQL> INSERT INTO T1 VALUES('A','B',NULL,2,1);
    1 row created.
    SQL> INSERT INTO T1 VALUES('A','B',1,NULL,1);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM T1;
    C1         C2         C3         C4             AUDIT1
    A          B                     2                   1
    A          B          1                              1
    SQL>I need to output from the above table as single row considering the Dupilcate values as once row ,and also nned to neglect the Null values from it and take the other possible value in it.
    C1         C2         C3         C4             AUDIT1
    A          B           1          2                   1

    Suppose a new row(below) is added, what do you expect as o/p?
    INSERT INTO T1 VALUES('A','B',1,3,2);Purvesh's query will give you the <tt>MAX(c4)</tt> but if you use <tt>SUM(c4)</tt> it'll also give you a single-row & NULLS removed but the values summed.
    -- "Query 1"
    select c1, c2, max(c3) c3, max(c4) c4, max(audit1) audit1
      from t1
    group by c1, c2;
    A     B     1     3     2
    -- "Query 2"
    select c1, c2, SUM(c3) c3, SUM(c4) c4, SUM(audit1) audit1
      from t1
    group by c1, c2;
    A     B     3     7     6Please clarify this.

  • How to set Back ground job & get my desired output layout in sm36 & sm37 ?

    Hai SAP ABAP/BASIS Gurus,
    I am currently taking ME2N PO Pending value Report by setting variant in input screen & setting my own output layout  ie only four field ie.Plant, Material,Currency,Still to be delivered value will be visible in output screen
    I set Back ground in sm36 using my variant & i saw my output in sm37.. But I cant get output as my desired field..
    This is my problem..
    1) I Cant Get the Same output in shedule job [sm36 & sm37] like When i run in foreground for ME2n.
        I am using ALV Scope of list..
    2) If I use BEST Layout in Scope of list means i get the desired Output field layout as same as my foreground output field..
    I want to get the output layout as desired & also in ALV format[ Useful for excel work]
    Kindly guide me.
    Thanks in advance..
    swetha
    Edited by: Swetha SAP Girl on Jul 2, 2009 5:06 PM

    Hi Swetha,
    To get the missed fields in the spool, while creating the background job(execute in background option) you can see the printer setting block at the end of the background job settings window, in that check the 'Spool Request Max. Width 255 char' check box and then continue. It will generate the spool list with maximum width and you can see all the fields in the spool output.
    Thanks,
    Muthu
    Edited by: Muthu Prabakaran Selvam on Jul 3, 2009 2:35 PM

  • Need Help in Getting the below output

    Hi All,
    The below is the table data.
    col1     col2     col3     col4     col5     col6
    Aa     1     Con     100     10     -1
    Ba     2     Cam     50     2     33
    Aa     1     Con     200     20     -2
    Ca     3     val     2     5     -10
    Aa     1     Con     150     30     -3
    Ba     2     Cam     20     3     11
    Ca     3     val     3     5     -20
    Ba     2     Cam     30     5     22
    Ca     3     val     5     4     -30
    I need the output as below. Please help me in getting the output.
    col1     col2     col3     col4     col5     col6
    Aa     1     Con     100     10     -1
    Aa     1     Con     200     20     -2
    Aa     1     Con     150     30     -3
    Aa-Con Subtotal          450     60     -6
    Ba     2     Cam     20     3     11
    Ba     2     Cam     30     5     22
    Ba     2     Cam     50     2     33
    Ba-Cam Subtotal          100     10     66
    Ca     3     val     2     5     -10
    Ca     3     val     3     5     -20
    Ca     3     val     5     4     -30
    Ca-val Subtotal          10     14     -60
    I am using Oracle 10g. Let me know if other details required.
    Thanks in Advance.
    Regards,
    Ravi Kumar Ankarapu.

    You can try using ROLLUP and GROUPING SETS like how some of the other forum members have suggested. Another way of getting the desired output would be :
    with t as
    select 'Aa' col1, 1 col2, 'Con' col3, 100 col4, 10 col5, -1 col6 from dual
    union all
    select 'Ba', 2, 'Cam', 50, 2, 33 from dual
    union all
    select 'Aa', 1, 'Con', 200, 20, -2 from dual
    union all
    select 'Ca', 3, 'val', 2, 5, -10 from dual
    union all
    select 'Aa', 1, 'Con', 150, 30, -3 from dual
    union all
    select 'Ba', 2, 'Cam', 20, 3, 11 from dual
    union all
    select 'Ca', 3 ,'val', 3, 5, -20 from dual
    union all
    select 'Ba', 2, 'Cam', 30, 5, 22 from dual
    union all
    select 'Ca', 3, 'val', 5, 4, -30 from dual
    select * from
        select * from t
        union all
        select distinct * from
            select col1 || '-' || col3 || ' Sub-total' col1, null col2, null col3,
            sum(col4) over (partition by col1 order by col1) col4,
            sum(col5) over (partition by col1 order by col1) col5,
            sum(col6) over (partition by col1 order by col1) col6
            from t
    order by col1, col2, col3
    Output:
    "COL1"     "COL2"     "COL3"     "COL4"     "COL5"     "COL6"
    "Aa"     "1"     "Con"     "150"     "30"     "-3"
    "Aa"     "1"     "Con"     "100"     "10"     "-1"
    "Aa"     "1"     "Con"     "200"     "20"     "-2"
    "Aa-Con Sub-total"     ""     ""     "450"     "60"     "-6"
    "Ba"     "2"     "Cam"     "50"     "2"     "33"
    "Ba"     "2"     "Cam"     "20"     "3"     "11"
    "Ba"     "2"     "Cam"     "30"     "5"     "22"
    "Ba-Cam Sub-total"     ""     ""     "100"     "10"     "66"
    "Ca"     "3"     "val"     "5"     "4"     "-30"
    "Ca"     "3"     "val"     "2"     "5"     "-10"
    "Ca"     "3"     "val"     "3"     "5"     "-20"
    "Ca-val Sub-total"     ""     ""     "10"     "14"     "-60"

  • How can I download itunes when I get the following errors...have installed and uninstalled a dozen times with various fixes...b noir for example and used Revo to clean up..ituneshelper did not install correctly error 7

    How can I download itunes when I get the following errors  ..ituneshelper did not install correctly error 7..I .have installed and uninstalled a dozen times with various fixes...b noir for example and used Revo to clean up.
    This has been a problem for 6 weeks now, I retry when I have time and patience and use my other laptop which is also Windows 7 and runs with no problem.
    Every attempt fails when all seems fine on the desktop and I try to log on to Itunes I get the errors.
    Any help greatly appreciated.
    billymac

    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features(Later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (If this won't uninstall press on)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    See also HT1925: Removing and Reinstalling iTunes for Windows XP or HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    Should you get the error iTunes.exe - Entry Point Not Found after the above reinstall then copy QTMovieWin.dll from:
    C:\Program Files (x86)\Common Files\Apple\Apple Application Support
    and paste into:
    C:\Program Files (x86)\iTunes
    The above paths would be for a 64-bit machine. Hopefully the same fix with the " (x86)" omitted would work on 32-bit systems with the same error.
    tt2

  • Inner join to get the mail id

    HI All,
    I have to get the email id by linking the following table.
    EKKO get vender number
    from LFA1 table get address ADRNR
    FROM ADR6 get the email id.
    how can i user inner join to achive the condition?
    Thanks in advance.

    Hi,
    Syntax errors are corrected here:
    tables: ekko, lfa1, adr6.
    data: l_lifnr like ekko-lifnr,
          l_adrnr like lfa1-adrnr,
          l_smtp_addr like adr6-smtp_addr.
    SELECT ekko~lifnr
             lfa1~adrnr
             adr6~smtp_addr
             into (l_lifnr, l_adrnr, l_smtp_addr)
             from ( ( ekko inner join lfa1 as lfa1 on ekko~lifnr = lfa1~lifnr )
                           inner join adr6 as adr6 on lfa1~adrnr = adr6~addrnumber ).
    write:/ l_lifnr, l_adrnr, l_smtp_addr.
    ENDSELECT.
    Hope it works
    thanks\
    Mahesh

  • I seem to have lost my wifi profile on my macbook air. How do I create another profile, or get the old one back?

    seem to have lost my WiFi profile on my Macbook air. How do I create another profile, or get the old one back?

    The profile will automatically be added back again when you connect to the network again. Here, I assume that you have a check mark in the box next to Remember networks this computer has joined.
    If the box is checked and the network does not appear, then there may be an operating system problem with your Mac.
    That would be beyond the scope of what we handle here with the AirPort Express, AirPort Extreme or Time Capsule, so you would want to post in the appropriate operating system community to follow up on that.
                  Mac OS & System Software     

  • I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten.

    I recieved an Adobe Master Collection License number from my school (Stevens Institute of Technology) and I can't figure out how to use it in order to get the product. I've created a username and that's as far as I've gotten. I need to download the product and I can't figure out where to begin.

    Ask someone at your school... Do you have a Cloud redemption code, or a CS6 serial number?
    If Cloud, Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html and
    http://www.adobe.com/products/creativecloud/faq.html
    http://helpx.adobe.com/creative-cloud/help/install-apps.html to install or uninstall
    http://forums.adobe.com/community/download_install_setup/creative_cloud_faq
    What it is http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html
    Cloud Getting Started https://helpx.adobe.com/creative-cloud.html
    If CS6, download at Other downloads and enter your serial number when prompted
    Again... your 1st resource is your school

  • I would like to know how to draw up a list in a cell (like a pull-down menu) to ease data capture, but I don't know how to do that  ! Do you get the idea ? Thanks !

    I would like to know how to draw up a list in a cell (like a pull-down menu) to ease data capture, but I don't know how to do that  !
    Do you get the idea ?
    Thanks ever so much !

    the numbers manual can be downlaoded from this website under the Apple support area...
    http://support.apple.com/manuals/#numbers
    What your looking for is written out step by step for drop downs and all other special types of user input starting around page 96 in the '09 manual.
    Jason

Maybe you are looking for

  • Limitation on Hierarchy levels

    Hi, I want to find out what is the limitation on number of Hierarchy levels (Custom Hierarchies) that can be created in BO Universe? And is this limitation oriented with the DB we connect? As I am using Netezza DB so I want to know the number of hier

  • Win 7 dual boot strategy

    I am in process of selecting a model of the Air.  I am more a PC guy than a MAC guy, but I 1, would like to become more facile with Mac and 2, I like the AIr "form factor".  I will likely choose a 256 or 512 model.  The main question is about the pro

  • Whenever I use Adobe Premiere Pro CC 2014, My macbook occasionally re-boots automatically! Any idea why and how to fix it?

    I am using a Macbook Pro 15" late 2013 model, and it works great. However, when I use Adobe Premiere Pro (which is a lot as I am studying editing) it occasionally freezes for a second then reboots itself. I got the details of the error and pasted the

  • Some questions on SRM 2007

    Hi All As per my earlier knowledge SRM 2007 ( EBP 6.0) is going to be released in Q4 2008. I read some people referring to it as SRM 7.0. 1) Is this wrong or SAP has officially changed it to SRM 7.0. 2) What is the corresponding version for SUS ? 3)

  • Java not recognized by Cisco Self-Provisioning Portal on Apple computers

    Have a Mac Mini running that had this problem under OSX 10.8 and is persisting in 10.9.  When this computers reaches the self-provisioning portal, after clicking submit on the MAC address registration, the following screen displays an erroneous error