Eliminate duplicate rows in the report

i have a report generated as shown below:
col1----col2-----col3---col4---etc..
1-------a---------x------aa==>row1
2-------a---------y------bb==>row2
1-------a---------x------cc==>row3
if u see the above displayed data for row1 and row3. it has same set of data in
col1,col2,col3.
Now ,i need to eliminitate the rows in the report which has same set of data in
col1,col2,col3(avoid duplication of this set of data )
but i cant do it while querying as there are other columns also, which make the
the whole row distinct.
so i think ineed to do it after the query process or while querying.
It would be very helpful for me If somebody can help me to find a solution for
this problem.
thanks in advance

SELECT
detail_date ,
agent_code ,
detail_piece,
vessel ,
journey_reference ,
doc_price,
local_code,
AMOUNT,
sum(amount) over (partition by local_code) SUM_AMT
FROM
(SELECT
ag.detail_date ,
ag.agent_code ,
dt.detail_piece,
dt.vessel ,
dt.journey_reference ,
dt.doc_price,
dt.local_code,
decode(dt.doc_price,'FE',decode(gl.category,'00',gl.amt),
               'FI',decode(gl.category,'00',gl.amt),
          decode(gl.category,'CC',gl.amt)) AMOUNT
FROM as_group ag,
as_doc_price dt,
as_line gl
WHERE ag.pas_id = dt.pas_id
AND     dt.doc_id = gl.doc_id
AND ag.pas_id = :p_pass)
Hi Gayathri,
the aove one is my exact query.You 'll find a SUM_AMT column inthat which calculates the total of AMOUNT in the suquery and displays it partitioning by local_ code, so if u have there local codes it displays the total three times.
But i need to display it only once at the end of the report,i mean for each distinct local_code.
i also tried using the same subquery along with a WITH clause so that i use the same subquery and select the other data and the partion by data seperately(in which case i gave distinct clause in the seperate select statement consisting of partition by clause) and finally make a UNION of the two queries .
it is as shown below:
WITH tab1 as(SELECT
ag.detail_date ,
ag.agent_code ,
dt.detail_piece,
dt.vessel ,
dt.journey_reference ,
dt.doc_price,
dt.local_code,
decode(dt.doc_price,'FE',decode(gl.category,'00',gl.amt),
               'FI',decode(gl.category,'00',gl.amt),
          decode(gl.category,'CC',gl.amt)) AMOUNT
FROM as_group ag,
as_doc_price dt,
as_line gl
WHERE ag.pas_id = dt.pas_id
AND     dt.doc_id = gl.doc_id
AND ag.pas_id = :p_pass)
SELECT
detail_date ,
agent_code ,
detail_piece,
vessel ,
journey_reference ,
doc_price,
local_code,
AMOUNT
FROM tab1
UNION
SELECT
null,
null,
null,
null,
null,
null,
local_code,
sum(amount) over (partition by local_code) SUM_AMT
from tab1;
the above query with WITH clause, worked fine in SQL plus, but in reports the same query gave me error "table or view tab1 does not exist" .When i removed the UNION from the with cluase thequery is OK in report(i'm not sure about this strange behaviour in report like same query that works in SQL plus fine , showing errors in report.If the above query i'm able run in reports its done for me but wat to do its not workin fine
So this is the situation i'm in..i have given a detailed reply...please be generous to ask if u need more info from my side..
Expecting a positive response from your side
Regards
DEV

Similar Messages

  • Eliminate duplicate rows from the report 6i output

    Hi All,
    I have generated a report output with the group by and summary options.
    For Ex: report has num and amount columns
    I had to sum the amount group by num
    NUM AMOUNT
    1 100
    1 50
    2 10
    2 100
    After group by and summary functions the report is generating the output as follows...
    NUM AMOUNT
    1 150
    1 150
    2 110
    2 110
    I want to eliminate the duplicate rows and want the output as follows...
    NUM AMOUNT
    1 150
    2 110
    I tried all the ways to implement distinct, but not able to.
    I donot want to implement distinct on the query but want to perform at the report level.
    Please help me in this ASAP.
    Thanks,
    Vijay

    It would be helpful if you post your query, should by something like
    SELECT NUM, SUM(AMOUNT)
      FROM TABLE
    GROUP BY NUM
    ORDER BY 1this would not create duplicates with your given example data.

  • How to eliminate the duplicate rows in the table

    How can we eliminate the duplicate rows in the table. Is it possible to write a single query or should we write a pl/sql block to do it

    Scope works outwards.
    SQL> DECLARE
      2    n NUMBER;
      3  BEGIN
      4    n := 0;
      5    DECLARE
      6      n number;
      7    BEGIN
      8      n := 2;
      9      dbms_output.put_line(n);
    10    END;
    11  END;
    12  /
    2
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2    n NUMBER;
      3  BEGIN
      4    n := 0;
      5    DECLARE
      6      x number;
      7    BEGIN
      8       dbms_output.put_line(n);
      9       n := 2;
    10        dbms_output.put_line(n);
    11    END;
    12  END;
    13  /
    0
    2
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    n NUMBER;
      3  BEGIN
      4    n := 0;
      5    DECLARE
      6      x number;
      7    BEGIN
      8       dbms_output.put_line(n);
      9       x := 2;
    10     END;
    11       dbms_output.put_line(x);
    12  EXCEPTION
    13     WHEN others THEN      dbms_output.put_line('oh no!');
    14* END;
    15  /
         dbms_output.put_line(x);
    ERROR at line 11:
    ORA-06550: line 11, column 27:
    PLS-00201: identifier 'X' must be declared
    ORA-06550: line 11, column 6:
    PL/SQL: Statement ignored
    SQL> Cheers, APC

  • Adding new row to the reports list page

    How can I add a new report row in the reports list of the reports tab.
    Ex: a new row to the report "users by Date of Join report" is to be added
    How can we add Please help me out in this

    I am facing the same problem!
    camickr wrote:
    Try adding an empty row containing a null value for the String instead of the empty String.camickr, it will not help, the DefaultRowSorter in the "*+compare(int model1, int model2)+*" method return -1 if the first value is null and 1 if the sacond value is null. and incase of DESCENDING it mult by -1.
                    // Treat nulls as < then non-null
                    if (v1 == null) {
                        if (v2 == null) {
                            result = 0;
                        } else {
                            result = -1;
                    } else if (v2 == null) {
                        result = 1;
                    } else {
                        result = sortComparators[counter].compare(v1, v2);
                    if (sortOrder == SortOrder.DESCENDING) {
                        result *= -1;
                    }And this is the real problem!
    The empty line is sorted as the smallest value and incase of DESCENDING it will be the first line (because of the mult by -1).
    We could have overide it and incase of the empty row(usualy the last row) do not mult by -1 in DESCENDING mode.
    But the problem is that the "+*compare*+" method and it's caller "*+Row+*" inner class are private :-(
    It is not wise to do it but we can do like kmp83 wrote:
    kmp83  wrote:
    copy/duplicate "private" code from DefaultRowSorter into my extended class.Anyone have another suggestion?

  • Duplicate rows in Webi Report

    Anyone can pls tell me how to avoid duplicate rows in a webi report. I have tried checking the 'Avoid duplicate row agg.' option as well as 'Retrieve duplicate rows'.
    The query that is generated in the webi gives proper results wehn run at the database level but not in the report.
    What can be the problem?

    Hi VickyBobj,
    It's hard to know, but my guess is the way the objects are defined in the universe. Make sure your measures are defined correctly, as sum, count, etc. and also make sure you have placed dimensions and measures correctiy within the report format - meaning generally dimensions in the headers and measures in the body.
    Thanks

  • Previous record values displaying in the Group Footer row in the report.

    Hi Friends,
    I have 3 tables
    TableA:(PERNR BEGDA ENDDA are key fields)
    PERNR BEGDA    ENDDA      WERKS
    10001 1/1/2010 12/31/9999 1001
    TableB:(PERNR BEGDA ENDDA SUBTY are key fields)
    PERNR BEGDA    ENDDA       SUBTY  TYPES
    10001 1/1/2010 12/31/9999   01          COMS1
    10001 1/1/2010 12/31/9999   02         COMS2
    TableC:(PERNR BEGDA  ENDDA are key fields)
    PERNR BEGDA  ENDDA        AMNT
    10001 2/2/1997 4/3/2010      1000
    10001 4/4/2010 12/31/9999  2000
    I have joined these table by the key 'PERNR'( like A->B and A->C)
    Groped by the same key 'PERNR'
    My result rows in the report:
    PERNR BEGDA    ENDDA      WERKS  SUBTY  TYPES  BEGDA    ENDDA      AMNT
    10001 1/1/2010 12/31/9999 1001       01         COMS1  2/2/1997 4/3/2010    1000
    10001 1/1/2010 12/31/9999 1001       02         COMS2  2/2/1997 4/3/2010    1000
    10001 1/1/2010 12/31/9999 1001       01         COMS1  4/4/2010 12/31/9999 2000
    10001 1/1/2010 12/31/9999 1001       02         COMS2  4/4/2010 12/31/9999 2000
    But in the report format is like this in the Group Footer row:
    PERNR: 10001                     WERKS:1001
    SUBTY: 02                          AMNT :2000 (Current date)
                                                AMNT :1000 (Previous record)
    I created the format with "Previous" function
    but in the report it is giving the '2000' instead of '1000' in the AMT field
    Please help me, can i use the for loop in the report? or any sugessions?
    Thanks in advance.
    Regards,
    Venkata

    A group footer will dis[lay contents of the last record. You need to sort records to ensure that the last record contains link to your dynamic image.
    Ian

  • IR Aggregation as a first row in the report

    Hi,
    I am calculating aggregation using actions in the IR, but my requirement i have to display the aggregation result as a first row in the report.
    version 4.1
    thanks in advance.
    regards
    Chandran

    Hi Jeff,
    Thanks for your reply,
    as you told i tried that CUBE and ROLL UP but i should display the grand total only not sub totals. and i should hi-light that total row also.
    for above requirements i have selected the actions functionality.
    regards
    Chandran

  • I want to fill the rows of the report from the loop

    I want to fill the rows of the report from the loop
    For example, in forms
    cursor bdl is select code,decode(:global.user_lang,1,name,2,latin_name) name
    from GL_ANALYSISHDR
    begin
         go_block('bdls');
         clear_block;
         first_record;
         for rec in bdl loop
         :bdls.code:=rec.code;
         :bdls.name:=rec.name;
         next_record;
         end loop;
         go_block('bdls');
         first_record;
    end;
    I tried to use the REF CURSOR
    But it return the values in one time and does not allow me to conduct and control of

    Why do you need to do it by a curesor loop? Can't you put the query in the datamodel of the report and simply pass the parameter to restrict the query?

  • Display the total number of rows for the report in OBIEE 11g

    Hi, In obiee 11g, the pagination will be 1-25. Is there any possiblity in obiee to show the total rows count next to pagination. Ex: if the result contains 120 rows. it should display after the pagination
    Records 1-25. Total of Records : 120
    Is there any way we can display the total number of rows for the report.
    Kindly help me.. Its very urgent requirement.
    MAny Thank in advacne

    Check this http://obiee100.blogspot.com/2011/07/display-total-number-of-records-in.html
    and
    http://docs.oracle.com/cd/E28280_01/bi.1111/e10544/appsql.htm#CHDCDIDA
    You have to go something like as suggested in previous link.
    Mark as correct/helpful

  • Want to update multiple rows of the report but getting a bug.

    hi,
    I am trying to update multiple rows of a report.For that I have created a teport with dynamic checkbox generated using ---HTMLDB_ITEM.CHECKBOX(1,utt.trouble_ticket_id) " "----.Checkboxes are rendered perfectly on the report.
    but when I tried to update the selected rows of the report as given in the documentation
    begin
    :P16_priority:=htmldb_application.G_F01.count;
    for i in 1..htmldb_application.G_F01.count
    loop
    update umanage_trouble_ticket set severity =:P16_priority where
    trouble_ticket_id = htmldb_application.G_F01(i);
    end loop;     
    end;
    I found that all the rows are updated.not only selected rows.
    and the count it gives =no of rows returned + no of rows selected.
    Please help me regarding this.
    thanx.
    BHARAT

    Hi Bernhard,
    I think that u didnt get y problem.
    When I take the value from "htmldb_application.g_f01(i)" then it should return id's of rows that are checked but when I do that it returns id's of all the rows.So I am not able to update only checked rows.
    from id's of rows i mean value provided when generating checkboxes through query.
    htmldb_item.checkbox(1,trouble_ticket_id) " "
    I am approching to the solution as specified in the documentation. "Adding check boxes to each row in a report".
    but still cant find any solution.
    thanx that u showed some intrest in my problem.
    If u can get the solution reply soon.
    Regards
    BHARAT

  • Hide the row on the report

    Hi experts,
    i am working on webi repots xir3 so that i had problem on the reports and then let me know how could i remove or hide  rows on the reports
    thanks & regards,
    Murali

    Hi,
    When you create a WEbi Query it generates reort with all columns. Now if you don't want to see one of the columns you can remove it by dragging to left of by deleting it
    May be you dont want to see when there is no data. If this is the case then you can select the report and then go to Properties tab and click the plus sign next to display and there you have control that if you want to see where there is data or not.
    I think this is what you wanted if not then let us know.
    Regards,
    Bashir Awan

  • -How to restrict Description into single row in the report

    Hello Colleagues
    I have a report which shows Material number versus Revenue. In the row, material is displayed with Technical name and description.
    Here, the view of the report shows the description in single line. While, in the report, description of the report runs 3 to 4 lines though description contains 5 to 6 words (which can fit easily into single line).
    Let me know how to restrict each row descrption into single line.
    Regards,
    Ningaraju

    Hello Colleagues
    Please find the format it is currently appearing in the web reports.
    Material Num        Material Description    Revenues (In Eur)
    1000001               "SAP
                                ERP
                                Professsional
                                 User"                             111
    Wanted to change above format into as below in which it has to show material description in single row.
    Material Num          Material Description                              Revenues (In Eur)
    1000001                 "SAP ERP Professsional User"                         111
    Regards,
    Ningaraju

  • Prompting user for input for each row in the report

    Is it possible to have a user entered field for each row in a report ?
    ie. have a report with empolyee number, employee name, title, salary, and comment. Select of of these columns from the SQL query except for the comment, and then when the report is generated have the user be prompted for what the want the comment to be for every employee in the report?

    That is, have the user generating the report enter in a different comment for EACH employee. (ie Joe Smith's comment is "good worker and John Smith's comment is "come to work late on Tuesdays and Thursdays", Sally Jones' comment is "Expert in C++" etc.) as the reports is being built for each row returned from the query.

  • How to show an image on each row of the report?

    I have created a report in apex. i want to display image on each row in a column of the report.
    How can i do this?

    See About BLOB Support in Forms and Reports in the documentation.
    There's an OBE tutorial that followed the introduction of declarative BLOB support in 3.1 as well.
    In future please
    <li>Search the forum before posting a new question. Most questions (including this one) have been asked and answered before.
    <li>Include as much relevant information with your question as possible, starting with:
    - APEX version
    - DB version and edition
    - Web server architecture (EPG, OHS or APEX listener)
    - Browser(s)/version(s) used
    - Theme
    - Templates
    - Region type(s)
    <li>Change your forum handle to something better than "845927".

  • Excel export contains a blank row for the Report Header

    Hi,
    I am getting a blank row as the first row in my SSRS report when exported to excel. I have already taken care of following things,
    1. I have hidden all of the Page Header items using Globals
    2. The position of Report Body Tablix is 0, that means there is no space between report header and Report Body.
    I have developed this Report in SSRS 2012, please let me know if any more details are required. I think even after hiding Header Items, excel creates a placeholder for page header. I can't remove header from my reports as it is needed to be published in
    pdf.
    Regards
    Mohit

    Hi Mohit,
    According to your description, you are getting a blank row as the first row in your excel report when you export the report to excel, you have hidden all the items in the Page Header by using the Globals, right?
    This blank row is for the page header, although you have hidden all the items in it, but it will still display when export report to excel. Because we can’t hidden the page Header directly. Normally, we can hidden all the items in the page Header, So in
    the design phase we can also see the blank area above the report body when preview.
    We have an alternative way by add the “SimplePageHeaders” setting in “RSReportserver.config” file, after configuration the page Header will not display in the first row of the worksheet but is rendered to the Excel page header. In Reporting Services, the
    “SimplePageHeaders” default value is “FALSE” and it indicates that the page header is rendered to the first row of the worksheet. In order to display the page header in the Header/Footer section of Excel, we need to set the “SimplePageHeaders” setting value
    to “TRUE”. I did a test on my local machine and here are my steps:
    Navigate to RSReportserver.config file: <drive:> Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\RSReportserver.config.
    Backup the RSReportserver.config file before modify it, open the RSReportserver.config file with Notepad format.
    Set the Excel rendering extension code like this:
    <Render>
    <Extension Name="EXCELOPENXML" Type="Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.ExcelOpenXmlRenderer,Microsoft.ReportingServices.ExcelRendering">
    <Configuration>
    <DeviceInfo>
    <SimplePageHeaders>TRUE</SimplePageHeaders>
    </DeviceInfo>
    </Configuration>
    </Extension>
    </Render>
      4.  Save the RSReportserver.config file.
    Note: Changing the rendering extension parameters only affects rendering operations on the Report Server.
    When I access to Report Manager and export the report(includes a page header) to Excel format, the blank row will disappear now.
    Similar thread for your reference:
    SimplePageHeader property in SSRS 2008 not working
    Removing 2 top blank rows when export to excel in ssrs 2008
    r2 report
    You can find more detail in these articles about the page header and page footer:
    Exporting to Microsoft Excel (Report Builder and SSRS)
    If you still have any question, please feel free to ask.
    Regards
    Vicky Liu

Maybe you are looking for