Summary column after each group

Hello,
I have programmed a sql statement which gives me the following data.
no   id     name            year    a     b    s_a    s_b  
1    700    Mrs. Smith      2012    36    7    101    13     
1    700    Mrs. Smith      2012    21    2    101    13    
1    700    Mrs. Smith      2012    27    2    101    13   
1    700    Mrs. Smith      2012    17    2    101    13   
2    163    Mr.  Heck       2012    80    12   170    17     
2    163    Mr.  Heck       2012    90    5    170    17   
3    515    Mrs. Peter      2012    40    0    40     0 It is possible to get the summary columns s_a und s_b after each id-group?
no   id     name            year    a     b         
1    700    Mrs. Smith      2012    36    7          
1    700    Mrs. Smith      2012    21    2           
1    700    Mrs. Smith      2012    27    2           
1    700    Mrs. Smith      2012    17    2         
                                    101   13
2    163    Mr.  Heck       2012    80    12           
2    163    Mr.  Heck       2012    90    5           
                                    170   17
3    515    Mrs. Peter      2012    40    0              
                                    40    0Does anybody have an idea?

Or
with t
    as
    select 1 no, 700 id, 'Mrs. Smith' name, 2012 year, 36 a, 7 b, 101 s_a, 13 s_b from dual union all
    select 1 no, 700 id, 'Mrs. Smith' name, 2012 year, 21 a, 2 b, 101 s_a, 13 s_b from dual union all
    select 1 no, 700 id, 'Mrs. Smith' name, 2012 year, 27 a, 2 b, 101 s_a, 13 s_b from dual union all
    select 1 no, 700 id, 'Mrs. Smith' name, 2012 year, 17 a, 2 b, 101 s_a, 13 s_b from dual union all
    select 2 no, 163 id, 'Mr.  Heck'  name, 2012 year, 80 a, 1 b, 170 s_a, 17 s_b from dual union all
    select 2 no, 163 id, 'Mr.  Heck'  name, 2012 year, 90 a, 5 b, 170 s_a, 13 s_b from dual union all
    select 3 no, 515 id, 'Mrs. Peter' name, 2012 year, 40 a, 0 b, 40  s_a, 0  s_b from dual
select no,id,name,year,sum(a) a,sum(b) b
from
        select t.*,row_number() over(partition by no,id order by a) rn
        from t
group by no,id,rollup(name,year,rn)
having (
        GROUPING(name),GROUPING(year),GROUPING(rn)
       ) in
            (1,1,1),
            (0,0,0)
NO                     ID                     NAME       YEAR                   A                      B                     
1                      700                    Mrs. Smith 2012                   17                     2                     
1                      700                    Mrs. Smith 2012                   21                     2                     
1                      700                    Mrs. Smith 2012                   27                     2                     
1                      700                    Mrs. Smith 2012                   36                     7                     
1                      700                                                      101                    13                    
2                      163                    Mr.  Heck  2012                   80                     1                     
2                      163                    Mr.  Heck  2012                   90                     5                     
2                      163                                                      170                    6                     
3                      515                    Mrs. Peter 2012                   40                     0                     
3                      515                                                      40                     0                     
10 rows selectedEdited by: jeneesh on Jan 23, 2013 3:25 PM
Simplified..

Similar Messages

  • Urgent: Oracle Reports : Blank Page Should print after each Group of record

    Hi all,
    I have a different kind of requirement, in my report I have 1 block and I want to generate a blank page after every group of records. This is because the printer is printing both side of the paper and we are giving multiple group at same time.
    Cannot touch the printer setup since it is a common one. Anybody can help me in this for a fast and simple way ? "Maximum records per page" property for the repeating frame give the next group to a fresh page but there will not be a blank page in between.
    Please help ..
    Thanks,
    Ani.

    Thank you for your attention.
    Empty frame with page break is not helping me since it will not hide the rest of the items which are outside the repeating frame. Like Report caption, Group Name, Page footer etc...
    If I am using the empty frame, is there any way to hide all other items ?
    Thanks,
    Anish

  • Putting cell border after each group

    I have 3 groups invoices, on account credits and on account receipts groups. In invoices group contain another group which is the application of the invoices. I want that every end of each invoices, will put a cell bottom border. And after the entire invoice group i will again put a cell bottom border to some of the columns.
    Need your help. if you want i can upload the xml output and xml template i have.
    Thank you so much.

    i cant upload files here but if anybody is interested i can send the files to you. really appreciate if somebody can help me.

  • Sorting by summary column, query based on previous query.

    Using 10g reports.
    I've got a report with one query currently thats broken down itno a couple groups. I'm trying to change the order they are displyed by based on a summary count of each group. I'm also trying to do another query for the report based on the results of the first one and display that with the information from the first.
    The report currently:
    Chain name
    ABC Stores
        Month
        JUN
         Store Name                   Store ID                bad sales
          Store1                         storeid1                   5
          Store2                         storeid2                   3
          Store3                         storeid3                   1
                                                         month total: 9
    JUL
          Store1                         storeid1                   6
          Store2                         storeid2                   5
          Store3                         storeid3                   2
                                                        month total:13
                                                        Chain total  22
    XYZ Stores
        JUN
          Store1                      storedid1                     20
          Store2                      storedid2                     15
                                                         month total  35
       JUL
          Store1                      storedid1                      11
          Store2                      storedid2                       7
                                                        month total     18
                                                         Chain total     53What I want to do is sort the order the store chains appear in based on the CHain total of bad sales. This is a summary done by the report and not in the sql query at the moment. I would also like to create a second query where it takes the store id and month from the first query and uses it to look up the total sales each store did so I can determine what percentage of the total sales the bad sales were. I would like to add this column plus a calculated percentage column to the right of the current columns but still have them grouped as they are. Is this possible to do or will i need to change my original query?
    Not very familiar with reports and I haven't been able to find anything to indicate how this should/could be done yet. Any help is appreciated.

    hi,
    there is no break order property for summary columns .
    so use the group by and take the sorting order for whole group
    example:
    SELECT DEPTNO, JOB, ENAME, SAL FROM EMP
    ORDER BY SAL
    You then create two groups, G_DEPT and G_JOB. G_DEPT contains
    the DEPTNO column and G_JOB contains the JOB column. If you
    specify a Break Order of Descending for the DEPTNO column and
    Ascending for the JOB column, your output would appear similar
    to that below (assuming you use a Tabular style):
    Deptno Job Ename Sal
    30 CLERK JAMES 950.00
    MANAGER BLAKE 2850.00
    SALESMAN WARD 1250.00
    MARTIN 1250.00
    TURNER 1500.00
    ALLEN 1600.00
    20 ANALYST SCOTT 3000.00
    FORD 3000.00
    CLERK SMITH 800.00
    ADAMS 1100.00
    MANAGER JONES 2975.00
    10 CLERK MILLER 1300.00
    MANAGER CLARK 2450.00
    PRESIDENT KING 5000.00

  • Displaying Summary Column Values

    I have just learned about summary columns in Developer 2000...But I can't complete the task...
    I'd like to display the # of records for each value in the status column of my report. I have created the break group with Status column. Then I added a summary column choosing function: "count", source: Status, and reset at: g_status (at the group level).
    What should I do next? I'd like to display counts of records (for each status value) in a separate field? How do I filter each status set? Do I need to create a separate summary column for each possible value of status?

    Hello,
    Is this what you are trying to achieve?
    rows:
    record_id Status
    ========= ========
    rec01     Active
    rec02     Closed
    rec03     Pending
    rec04     Active
    rec05     Closed
    rec06     Pending
    rec07     Active
    rec08     Closed
    rec09     Pending
    rec10     Active
    rec11     Closed
    rec12     Pending
    rec13     Closed
    rec14     Pending
    rec15     Closed
    output:
    Active    4
    Closed    6
    Peding    5If so, you will need two groups, one for the Status, and another for the records.
    Then, create a summary column in the status group of function 'count' and the source = record_id, and reset at g_status.
    Then, in your report layout, have a repeating frame with source = status group.
    Inside that repeating frame create 2 text items, one for the status text and another for the status summary.
    -Marilyn

  • Summary Column

    Dear All
    I have block with amount and type columns
    i want to create two summary column sum the amount column regarding to the type
    example :
    amount    type
    1000         1
    2000          2
    500           1
    600            2
    1st summary column for type 1 =1500
    2st summary column for type 2 =2600
    Can any one help me ?
    Thanks in advanced

    Hi Slava,
    I did the following and it works:
    1. Create 2 queries (just for this example)
    select * from employees
    select * from departments
    2. Create a sum_salary summary column outside any group in the Data Model (Reset At "Report") - this is sum from query 1
    3. Create a sum_department_id summary column outside any group in the Data Model (Reset At "Report") - this is sum from query 2
    4. Create a Formula Column, again outside any group in the Data Model. PL/SQL Formula is:
    begin
    return :sum_salary + :sum_department_id;
    end;
    5. Place all these 3 columns in separate frames in the Paper Layout.
    Let us know if you face any problems.
    Navneet.

  • Can i get summary column value of one group appears at the last page once

    Hi,
    I am having one group G_Item.I need the summary column(CS_Total_quantity->source as :cp_quantity) value as Total quantity value of the report andprint it on the last page.How can i get that value?Please advise me.Urgent......Waiting for reply.
    Thank You

    try this...
    put a summery column outside the quey.
    & take sum of "CS_Total_quantity".
    set its reset at property to "report". & print object on "last page".
    hope this 'll work for u.
    Capri...

  • Using Page Level Summary Column in Report 6i

    Hi Folks,
    I'm trying to create a report in which I want a Page level Summary column i.e., the Summary column should reset at each page and should display the sum of a particular field on each page depending upon how many records are displayed on each page. But whenever I choose the Reset Property to Page the following error is displayed" Page level summaries are not supported in the defaulting" and in certain case the summary column displays the sum only on the last page of the report and the rest of the pages do not display the summary column. The database has three tables i.e., master-detail-detail.
    Do I need to make some changes in the Data Model or what?
    TIA
    Hassan

    Hi Hassan,
    it only works onceWell, this is definitely not expected. Maybe you can try to see after running the report once whether all the values you set in your report (from my last post) remain the the same, or somehow they revert back to their default values.
    if I do some formatting of the report... summary also disapperasYou could try placing the page level summary in another frame, below your group repeating frame, with enough gap between them. Also, try setting the value for "max no of records" to some lower value, which makes sure there is space for the summary column on every page.
    Another idea for making a page level summary is - you can place the summary BEFORE your group repeating frame, which means the summary will print on top of every page. In this case, you won't even have to worry about setting "max no of records per page" to some particular value. See if this suits your needs.
    Navneet.

  • How to get summary columns in delimited text file

    How to get summary columns in delimited text file
    I am trying to generate a delimited text file output with delimited_hdr = no.The report is a Group above report with summary columns at the bottom.In the text file the headers are not getting repeated & thats ok.The problem is the summary data is getting repeated for each row of data.Is there a way where i will get all the data & summary data will get displayed only once.I have to import the delimited text file in excel spreadsheet.

    Sorry there were a typos :
    When I used desformat=DELIMITEDDATA with desttype=FILE, I get error "unknown printer driver DELIMITEDDATA". When you look for help, DELIMITED is not even listed as one of the values for DESTFORMAT. But if you scroll down and look for DELIMITER it says , this works only in conjuction with DESTFORMAT=DELIMITED !!!!!!??!! This is in 9i.
    Has this thing worked for anybody ? Can anyone please tell if they were able to suppress the sumary columns or the parent columns of a master-detail data for that matter ?

  • ?for-each-group? dosen't work with page break - rtf template???

    Hello all,
    When I give a page break inside the for-each-group the group doesn't iterate any code after the page break. I can't give <?split-by-pagebreak?> in this case because I want that loop to be iterated for every department, and should show the report in one column(ms word column), and the department description in two columns.....as this has to happen for every department I can't write separate code........everything should go into one file......
    Final file should look like:
    <for every department>
    <department_report-a table>--one column(ms word column)
    <department_description-a huge text>--two columns(ms word columns)
    <next department>
    how can I achieve this - please help, its urgent.
    Thanks for your time.
    DK

    bipuser thanks for your response
    i will have table data also so i cannot keep in the same line.
    its strange for the last 2-3 days below syntax gave me space at the beginning of each group now it is working i didnt do any change
    <?for-each:G_1?>
    ABCDEFDG
    <?split-by-page-break:?><?end for-each?>

  • Summary Column and repeating frames

    I have a report that shows customer orders(1 per page). If a customer orders 3 pizzas and 2 of them are identical, same size, same toppings, crust i want the quanitity column to sum as 2. So for this example instead of having 3 rows with two of them being identical with the quanity column dispalying 1 for each, I want 2 rows with quanity showing 2 for the identical pizzas and 1 for the other.
    I have everything in the same group/repeating frame right now and it is showing all 3 pizzas on there own row. Do i need a summary column and change my groupings? How can i achieve this the summed quanity for identical orders?
    CURRENT:
    Crust......Toppings......size.....quantity
    Thin.......Cheese........small....1
    Thin.......Cheese........small....1
    thick.......meat.........large....1
    NEW:
    Crust......Toppings......size.....quantity
    Thin.......Cheese........small....2
    thick.......meat.........large....1

    Forget summary columns. This can easily be just a group by query:
    with t as (select 'Thin' crust, 'Cheese' top ,'Small' sze, 1 qty from dual
               union all
               select 'Thin' , 'Cheese'  ,'Small' , 2 from dual
               union all
               select 'Thick' , 'Meat'  ,'Large', 1  from dual
    select t.crust, t.top, t.sze, sum(qty)
    from t
    group by crust,top,sze;
    CRUST TOP    SZE     SUM(QTY)
    Thin  Cheese Small          3
    Thick Meat   Large          1

  • Oracle rdf summary column is not working as expection

    hi
    I have Requirement  to bring as below Format
    emplo name
    project name
    project nnumber
    cp_1
    cp-2
    ...cp_25
    mark
    abc
              123
    20
    30
    10
    mark
    dfc
              234
    25
    35
    15
    mark
    45
    65
    25
    for that i have created the Rdf  and rtf
    In Oracle Report
    One group
    data model query
    group name G_project_number
    and i create formula column  to give the values in the cp_1 to cp_25
    My RTF format
    Employee name
    project name
    project number
    cp_1
    cp_2
    ..cp_25
      <for each : g_project_number><?employee nmae?>
    <?project name?>
    <project number ?>
    <?cf_1?>
    <?cf_2?>
    ...<?cf_25?>
    <?employeename?>
    <?cs_1?>
    <?cs_2?>
    ..<?cs_25?><end for -each>
    summary columns in the same data model  group
    now report is showing as accumalate value for the columns
    employee name
    project name
    project number
    cp_1
    cp-2
    ...cp25
    mark
    abc
    123
    20
    30
    10
    mark
    20
    30
    10
    mark
    dfc
    234
    25
    35
    15
    mark
    45
    65
    25
    and my data model
    one group
    all info in that
    Please guide me  how to take forward this to achieve
    Thanks  in advances

    Please check the below link just to make sure all steps are taken care.
    http://oraclemaniac.com/2012/08/15/how-to-add-a-descriptive-flexfield-dff-in-a-custom-oracle-apps-form/

  • Summary columns in portal forms

    i have a master-detail form and i need to sum(one of detail columns) and display the result in the master block.
    has anyone any ideas on how to have a summary column in master in oracle portal ?
    has anyone done this before ?
    thanx
    null

    Not exactly what you want, but I have managed to put a summary table at the end of the detail block. This gives a total for all detsail records for the current master, not just those displayed.
    Add a pl/sql block to the 'after displaying the page' section of the Additional PL/SQL code tab to run the code you need. THis pl/sql block will include the p_session.get_value function to get the identifier of the master record, a query on the detail table and the HTML code to display the results.
    Another method might be to create a view to contain the summary details you need for each master record, and base the master block on this view.

  • Displaying subtotals for each group item in a Matrix or Group Matrix Report.

    Hi,
    I have generated a Report as follows:
    month1 month2 month3
    M1 R1 P1 x y z
    P2 a b c
    R2 P3 d e f
    M2 R3 P4 g h i
    R4 P5 k l m
    Is it possible to display the subtotals per each category as follows:
    month1 month2 month3
    M1 R1 P1 x y z
    P2 a b c
    -------------------------- x+a y+b z+c
    R2 P3 d e f
    ------------ (x+a)+d (y+b)+e (z+c)+f
    M2 R3 P4 g h i
    R4 P5 k l m
    ------------ g+k h+l i+m
    ---- ((x+a)+d) ((y+b)+e) ((z+c)+f)
    + (g+k) + (h+i) + (i+m)
    waiting for the solution desparately.

    Your digram isn't very clear. It looks like you have a matrix that is made up of:
    Across Group (G_Across) producing: month1, month2, month3
    Down Group (G_Down1) producing: M1, M2
    Down Group (G_Down2) producing: R1, R2, R3, R4
    Down Group (G_Down3) producing: P1, P2, P3, P4, P5
    and then you have the matrix cell values: x, y, z, a, b, ... m
    Basically, you want to introduce a summary column at the G_Down2 level that is a running summary, resetting at G_Across.
    To do this you need to create a matrix summary with the correct product order and reset value. The product order determines when the value is calculated. In your case, you want the value to be calculated: once Per G_Across, then once per G_Down1, then once per G_Down2. Leaving the reset value at "Report" will give you the subtotal values for all columns. You need to re-set this to G_Across since you want to only get a sub-total for each column.
    Steps:
    - Create a summary column in the data-model in the matrix group with the following:
    Name: CS_SubTotal
    Source: <your matrix cell column>
    Product Order: G_Across G_Down1 G_Down2
    Reset at: G_Across
    - increase the vertical size of G_Across to make room for the new field
    - increase the size of G_Down1 to fill up the space you've created
    - increase the size of G_Down2 to fill up the space you created
    - insert a field into this space (should be the matrix frame whose properties are:
    Vertical Repeating Frame: G_Down2
    Horizontal Repeating Frame: G_Across)
    - bring up the property palette against the field and set the source to: CS_SubTotal

  • Summary column  OS confliction problem

    hi
    Ihave a big  problem  in  each time   using a summary column  on it
    I creat my summary column icon on the datamodel then I connect to database normally ,but   after writing the query and press next  an Os  window appears that says
    reports builder has encountered a problem and need to close.
    please tell microsoft about this problem
    When gong further by links I find the following information
    the following file will be included in this report error
    C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\a497_appcompat.txt
    please can anyone help?
    thanks.
    windows os.
    developer 6i
    database 9i

    It's in report
    specifically on the query statement of the datawizard window
    for further details It's say as following ;-
    tell Microsoft about this problem.
    to see what data this error report contains ,click here
    after clicking
    Error signature:-
    AppName: rwbld60.exe     AppVer: 3.0.0.0     ModName: rwlib60.dll
    ModVer: 0.0.0.0     Offset: 00245977
    This error report includes:information regarding the condition of reports builder when the problem occurred;the operating system version and computer hardware in use ;your Digital product id,which could be used to identify
    your license; and the internet protocol[ip] address of your computer.

Maybe you are looking for