Tricky sql for report purpose

Hi all,
Please see the example and help me out is there any solution to get below Required output.
with t as (select '61527' as cp_Code,'RELEASE SWITCH' as Cp_Des,'88967095' as Part_No,'1800' as List_Price from dual union all
select '61527' as cp_Code,'RELEASE SWITCH' as Cp_Des,'88967095' as Part_No,'909' as List_Price from dual union all
select '61527' as cp_Code,'RELEASE SWITCH' as Cp_Des,'89018180' as Part_No,'4071.53' as List_Price from dual union all
select '61527' as cp_Code,'RELEASE SWITCH' as Cp_Des,'89018180' as Part_No,'5755.25' as List_Price from dual union all
select '61527' as cp_Code,'RELEASE SWITCH' as Cp_Des,'TEST1' as Part_No,'100' as List_Price from dual)
select * from t
Output of the above query
cp_Code          Cp_Des               Part_No          List_Price
61527           RELEASE SWITCH           88967095      1800
61527           RELEASE SWITCH           88967095      909
61527           RELEASE SWITCH           89018180      4071.53
61527           RELEASE SWITCH           89018180      5755.25
61527           RELEASE SWITCH           TEST1      100
Required output like this
cp_Code          Cp_Des               Part_No          List_Price
61527      RELEASE SWITCH      88967095                1800
                                        909
                         89018180                4071.53
                                        5755.25
                         TEST1                100
Thanks in advance .

Hi,
As Karthick said, the Presentation Layer is the best place to handle formatting like this.
For example, in SQL*Plus you can use the BREAK command:
BREAK     ON cp_code NODUPLICATES     ON cp_des NODUPLICATES     ON part_no NODUPLICATES
SELECT       *
FROM       t
ORDER BY  cp_code
,       cp_des
,       part_no
,       list_price
;Output:
CP_CO CP_DES         PART_NO  LIST_PR
61527 RELEASE SWITCH 88967095 1800
                              909
                     89018180 4071.53
                              5755.25
                     TEST1    100If you want the rows in the order in which you posted them, just change the ORDER BY clause.
This site notmally won't display multiple spaces (or tabs) together.
When posting formatted text (like your output), type these 6 characters:
(all small letters, inside curly brackets) before and after formatted sections.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Sliding window sanario in PTF vs Availability of recently loaded data in the staging table for reporting purpose

    Hello everybody, I am a SQL server DBA and I am planning to implement table partitioning on some of our large tables in our data warehouse. I
    am thinking to design it using the sliding window scenario. I do have one concern though; I think the staging tables we use for new data loading and for switching out the old partition are going to be non-partitioned, right?? Well, I don't have an issue with
    the second staging table that is used for switching out the old partition. My concern is on the first staging table that we use it for switch in purpose, since this table is non-partitioned and holding the new data, HOW ARE WE GOING TO USE/access THIS DATA
    FOR REPORTING PURPOSE before we switch in to our target partitioned table????? say, this staging table is holding a one month worth of data and we will be switching it at the end of the month. Correct me if I am wrong okay, one way I can think of accessing
    this non-portioned staging table is by creating views, which we don’t want to change our codes.
    Do you guys share us your thoughts, experiences???
    We really appreciate your help.

    Hi BG516,
    According to your description, you need to implement table partitioning on some of our large tables in our data warehouse, the problem is that you need the partition table only hold a month data, please correct me if I have anything misunderstanding.
    In this case, you can create non-partitioned table, import the records which age is more than one month into the new created table. Leave the records which age is less than one month on the table in your data warehouse Then you need to create job to
    copy the data from partition table into non-partitioned table at the last day of each month. In this case, the partition table only contain the data for current month. Please refer to the link below to see the details.
    http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/
    https://msdn.microsoft.com/en-us/library/ms190268.aspx?f=255&MSPPError=-2147217396
    If this is not what you want, please provide us more information, so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Grouping of vendor's for reporting purpose

    Dear Experts,
    i have an issue where i have different vendor code (For example - IBM- Mumbai, IBM-Bangalore,IBM- US,IBM-Germany). i have created different vendor code for all these companies.
    Now i want to link all these vendors under single grouping code  so that i can see the report based on group company "IBM" that what all the business i have done against the group company "IBM".
    Is there any concept of grouping several vendor's under single code for reporting purpose.
    Plz suggest.

    The best way to resolve your issue i think is by creating a vendor class with class type 010 in t/code CL02...before this create a characteristic where maintain the Vendor codes & name in Values data tab in t/code CT04 and assign the same in CL02...now you can use this class in any vendor related report by using the option Vendor by class.
    Regards,
    Indranil

  • Capture balances in dep area for reporting purposes

    We use standard depr. area 01 for postings to GL. We have created area 50 for replacement value
    When we settle or amortise assets area 01 gets updated but area 50 doesn't - is there a way to get values recorded in area 50 so for reporting purposes we can see current replacement values? Right now its zero
    In addition we'd like to have some sort of index on the replacement value lets say linked to inflation index etc, something like that, so that for e.g. our buildings have a book value of $1 million but replacement value is $2 million after indexing has been applied
    Thanks for help
    Julian

    Hi Stefen,
    Please refer below link:
    http://help.sap.com/saphelp_470/helpdata/en/4f/71dc62448011d189f00000e81ddfac/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/4f/71dc62448011d189f00000e81ddfac/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/de/394dcc9475034ab09124fe2e22c66a/frameset.htm
    hope this helps.
    Please assign points as way to say thanks

  • Need an approach regarding reporting for a one-to-many primary-child relationship, where there are more than three child objects for a primary object for reporting purpose

    Business Scenario- We have a parent organization with 6 different Business Units.One BU requires 9 stages for for Opportunity(Tender) Tracking.The client requirement is to show the basic details of the tender at the header level and to show details specific to individual sales stage as different tabs.There will be multiple opportunity members added as opportunity team and will be responsible for capturing details specific to individual sales stage(tab). The Tab should be enabled and disabled based on the role. Reporting is required against each stage with specific fields of child objects against each opportunity.
    We created multiple children entities under the oportunity(one to many mapping) but we are unable to add more than 3 child objects for a primary object for reporting purpose.
    Kindly suggest what needs to be done to meet the requirement

    Can you provide the exact steps you took to  "created multiple children entities under the oportunity" ?
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • Categorizing Vendors for reporting purposes.

    Dear experts,
    I would like to set up our new system in such a way that our vendors are categorized according to the reporting requirements from business, i.e. procurement.
    What is the best way to conduct this? Is there a standard way, or are accountgroups normally used?
    I know vendor hierarchies, which are normally used to represent the structure of a particular vendor and it's subsidaries.
    Then there are the corporate groups to place them in a holding of companies.
    What's your experience on this?
    BTW, are SAP classifications often used to categorize vendors for reporting purposes?
    Thanks for your input.

    Hi Schotanus,
    Please put in SD blog and get the help.
    Regards,
    Anil

  • EBusiness tax feature "Tax for Reporting Purposes Only"

    Hi everyone,
    Did anyone used "Set Tax for Reporting Purposes Only" feature in Etax? If yes, then can you, please, describe me how works in AP/AR modules. Because for some reasons I cannot make it work and Etax User Guide does not contain much information about it.
    Thanks in advance,
    Vladimir

    As I mentioned in the PM, I'm going to list an alternate tax solution here.
    It involves using a single tax amount (the lower amount) on all products. That may not sound right, but with some additional steps it's not a bad solution.
    Assuming you have two tax amounts, one at 7.5% and another at 9%, you assign all taxable products the lower tax amount.
    Then you change the price of the higher taxed products by the difference in the percentage. (if the product was $1, then it is now $1.02) Part of why this works is because the increase is not so significant that customers would usually care.
    Using the product attributes, you set up a dropdown list with the options, "tax1" and "tax2"
    Each product, in a custom1 field is assigned its appropriate tax name (tax1 or tax2).
    The dropdown list is hidden, so the customer doesn't know it's there
    When a customer looks at a large product view, js automatically selects the appropriate attribute based on what is in the custom field.
    Set up two reports, one for each tax group.
    Filter them by attribute, so only the applicable products are shown in the report
    Using very simple math (Total x 1.075 and Total x 1.09, depending on which report it is), the accountant will know exactly how much to pay in taxes for each tax type.
    At first glance, this looks like a bad solution, but all that really matters is that the company is collecting and paying their taxes. Your client charges the lower amount so they are not overcharging taxes (kind of illegal). The slight price increase of the higher taxed products covers the rest and then some.

  • Using Oracle Essbase For Report Purpose

    Good afternoon all,
    I am new in Oracle Essbase. I will appreciate If I can get a link on how to setup Essbase and use it for report purpose.

    start here http://download.oracle.com/docs/cd/E12825_01/nav/portal_1.htm it has all of the information on installation and setup

  • ORA-01489 Received Generating SQL for Report Region

    I am new to Apex and I am running into an issue with an report region I am puzzled by. Just a foreword, I'm sure this hack solution will get a good share of facepalms and chuckles from those with far more experience. I welcome suggestions and criticism that are helpful and edifying!
    I am on Apex 4.0.2.00.07 running on 10g, I believe R2.
    A little background, my customer has asked an Excel spreadsheet be converted into a database application. As part of the transition they would like an export from the database that is in the same format as the current spreadsheet. Because the column count in this export is dynmic based on the number of records in a specific table, I decided to create a temporary table for the export. The column names in this temp table are based on a "name" column from the same data table so I end up with columns named 'REC_NAME A', 'REC_NAME B', etc. (e.g. Alpha Record, Papa Record, Echo Record, X-Ray Record). The column count is currently ~350 for the spreadsheet version.
    Because the column count is so large and the column names are dynamic I've run into a host of challenges and errors creating this export. I am a contractor in a corporate environmentm, so making changes to the apex environment or installation is beyond my influence and really beyond what could be justified by this single requirement for this project. I have tried procedures and apex plug-ins for generating the file however the UTL_FILE package is not available to me. I am currently generating the SQL for the query in a function and returning it to the report region in a single column (the user will be doing a text-to-column conversion later). The data is successfully being generated, however, the sql for the headers is where I am stumped.
    At first I thought it was because I returned both queries as one and they were joined with a 'union all'. However, after looking closer, the SQL being returned for the headers is about +10K+ characters long. The SQL being returned for the data is about +14k+. As mentioned above, the data is being generated and exported, however when I generate the SQL for the headers I am receiving a report error with "ORA-01489: result of string concatenation is too long" in the file. I am puzzled why a shorter string is generating this message. I took the function from both pages and ran them in a SQL command prompt and both return their string values without errors.
    I'm hopeful that it's something obvious and noobish that I'm overlooking.
    here is the code:
    data SQL function:
    declare
      l_tbl varchar2(20);
      l_ret varchar2(32767);
      l_c number := 0;
      l_dlim varchar2(3) := '''|''';
    begin
      l_tbl := 'EXPORT_STEP';
      l_ret := 'select ';
      for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
      loop
        if l_c = 1 then
            l_ret := l_ret || '||' || l_dlim || '|| to_char("'||rec.column_name||'")';
        else
            l_c := 1;
            l_ret := l_ret || ' to_char("' || rec.column_name || '")';
        end if;
      end loop;
        l_ret := l_ret || ' from ' || l_tbl;
      dbms_output.put_line(l_ret);
    end;header sql function:
    declare
      l_tbl varchar2(20);
      l_ret varchar2(32767);
      l_c number := 0;
      l_dlim varchar2(3) := '''|''';
    begin
      l_tbl := 'EXPORT_STEP';
      for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
      loop
        if l_c = 1 then
            l_ret := l_ret || '||' || l_dlim || '||'''||rec.column_name||'''';
        else
            l_c := 1;
            l_ret := l_ret || '''' || rec.column_name || '''';
        end if;
      end loop;
        l_ret := l_ret || ' from dual';
      dbms_output.put_line(l_ret);
    end;-------
    EDIT: just a comment on the complexity of this export, each record in the back-end table adds 12 columns to my export table. Those 12 columns are coming from 5 different tables and are the product of a set of functions calculating or looking up their values. This is export is really a pivot table based on the records in another table.
    Edited by: nimda xinu on Mar 8, 2013 1:28 PM

    Thank you, Denes, for looking into my issue. I appreciate your time!
    It is unfortunately a business requirement. My customer has required that the data we are migrating to this app from a spreadsheet be exported in the same format, albeit temporarily. I still must meet the requirement. I'm working around the 350 columns by dumping everything into a single column, which is working for the data, however, the headers export is throwing the 01489 error. I did run into the error you posted in your reply. I attempted to work around it with the clob type but eneded up running into my string concatentation error again.
    I'm open to any suggestions at this point given that I have the data. I'm so close because the data is exporting, but because the columns are dynamic, the export does me little good without the headers to go along with it.

  • How to set up hierarchy for GL Accounts - for reporting purpose

    Hi All,
    we are using OBIEE 10g with Oracle R12 as our OLTP.
    my question is that I have configured - Section 3.2.1.6.1, "How to Configure GL Account Hierarchies Using GL Accounting Flexfield Value Sets Definitions."
    and I'm getting the correct hierarchy now.
    few codes from my config files given below. we have used Actual Parent Account numbers in order to sort the TrialBal report in a particular format, Group Account Num in character format were not serving our purpose.
    Now as you can see with this configuration obviously the standard reports (Balancesheet) are coming blank.
    I would need to configure these group account codes for every BMM layer folder to include our group account numbers.
    Also I need to have a specific format for balancesheet ..now seeing the below format please advice me where and how do i configure this drill down hierarchy?
    because "Non Current Assets>>Fixed Assets" "Investments" are just group labels and not defined in the system anywhere. so how do I achieve this format in the report with drill down
    Balance Sheet Format like below-
    Sl No     Particulars
    A     Non Current Assets
    A.1     Fixed Assets
    A.1.1     Fixed Assets
    A.1.1.1     Asset Cost (total Balances frm natural GL Account 101010 to 101130)
    A.1.1.2     Accumulated Depreciation (total Balances frm natural GL Account frm 105010 to 105160)
    A.1.1.3     Asset Clearing (total Balances frm natural GL Account frm 104510 to 104630)
    A.1.2     CWIP (total Balances frm natural GL Account frm 102010 to 102120)
    A.1.3     Intangibles (similarly like above some account range)
    A.1.3.1     Intangibles Cost (similarly like above some account range)
    A.1.3.2     Accumulated Amortization (similarly like above some account range)
    A.2     Investments
    A.2.1     Investment in Shares
    A.2.2     Investment in New Ventures
    A.2.3     Investment in Properties
    A.2.4     Properties under Construction
    A.2.5     Advances for Investment Properties
    B     Current Assets
    B.1     Inventories
    B.1.1     Finished Goods
    B.1.2     Packing Materials
    etc.
    file_group_acct_codes_ora.csv
    CHART
    OF
    ACCOUNTS
    ID FROM ACCT TO ACCT     GROUP_ACCT_NUM
    50328     101010     101999     101000
    50328     102010     102999     102000
    50328     103010     103999     103000
    50328     104010     104210     104000
    50328     104501     104999     104500
    50328     105010     105160     105000
    =========================================
    file_group_acct_names.csv
    GROUP_
    ACCOUNT
    NUM     GROUP_ACCOUNT_NAME     LANGUAGE
    101000     Fixed Assets-Cost     E
    102000     Capital Work In Progress-Cost     E
    103000     Asset Cost-Intangibles     E
    104000     Fixed Assets-Cost Clearing     E
    104500     CWIP Cost Clearing     E
    ==========================================
    file_grpact_fstmt.csv
    GROUP FIN_STMT
    ACCT       ITEM GL_ACCT_
    NUM     CODE     CATCODE
    101000     AP     BS
    102000     AP     BS
    103000     AP     BS
    104000     AP     BS
    104500     AP     BS
    ===============================================
    file_glacct_segment_config_ora.csv
    CHART OF ACCOUNTS_ID     SEG1     SEG1_VALUESETID     SEG2     SEG2_VALUESETID     SEG3     SEG3_VALUESETID     SEG4     SEG4_VALUESETID     SEG5     SEG5_VALUESETID     SEG6     SEG6_VALUESETID     SEG7     SEG7_VALUESETID
    50328     SEGMENT1     1013524     SEGMENT2     1013525     SEGMENT3     1013526     SEGMENT4     1013527     SEGMENT5     1013524     SEGMENT6     1013528     SEGMENT7     1013529
    AGGREGATION     Y          Y          Y          Y          Y          Y          Y
    ==================================================

    Dear Balaji,
    You can directly create hierarchies in the transaction COMM_HIERARCHY.
    You can assign Category Hierarchies to Applications in the IMG (transaction SPRO): Cross-Application Components => SAP Product => Product Category => Assign Category Hierarchies to Applications.
    (Alternatively, you can transport selected hierarchies and their categories to a specified target system in the same IMG path Cross-Application Components => SAP Product => Product Category => Transport Categories.)
    Hope I was able to help you!
    imre

  • Using values returned from SQL for Report column names

    I am building reports against our TFS development db.
    One of the reports tracks days spent (Dwell Time) in various status categories (eg: New, Assigned, In Development, Hold, etc) for a given "ticket".
    For a fixed list of values from {Work Item].System_State, I can send the results (days in Assigned) to the column named (Assigned) for each status for each event in the [Work Item History], and then sum them for each ticket as:
    Ticket ID      New          Assigned       InDev       etc
    1230001        2                  0                 0          ...
    1230001        0                  1                 2          ....      
    SUM            2                    1                2         ....            
    However, I have many different Projects, each of which use their own Status names.
    I don't want to duplicate the same basic report, if I can avoid it.
    How can I name and generate this data for the unique Status list for each Project?
    Simplest analog is:  name = First(Fields!Status.Value, "TFSdb")
    and allows value for a column name (category) as: =IIF(Fields!Status.Value = First(Fields!Status.Value, "TFSdb"), Fields!Days.Value, 0)
    However this fails beause:
    1. It only delivers the FIRST status value, and,
    2. I cannot SUM an expression which is itself an aggregate (using First).

    RRapport,
    Is this still an issue?
    Thanks!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Grouping materials for reporting purposes

    Hi,
    What field in the material master record will you recommend to use to group materials (finished goods) for management reporting?  For example - in the management accounts you have 2 categories "Ready-to-eat meals" and "Ready-to-cook meals".
    What field do you recommend to use to assign the materials to a specific category?  Please indicate why and what are the advantages & disadvantages.  It has happened before that the assignment need to be changed (that a specific material needed to be allocated to a different category after creation).
    Thank you in advance for your help.

    Hi,
       If its on MM point of view, I would suggest to go for material group. The material group is there in all the purchasing reports (ME2* reports), Inventory reports (MB52), etc.
       But the material group is at client level (MARA). and  is possible to assign only one material group per material. If the same material is to be assigned to different categories, you may check the material group 1, material group 2 etc options in sales view. But these are specifically for sales side reporting and not available in standard MM reports.
       Please share which reports you want to take based on the grouping...
    Regards,
    AKPT

  • Adobe licenses - import into SCCM (for reports purpose)

    Dear Adobe community
    Are there any good tricks for importing Adobe license keys from our Adobe Volume License web page into a SCCM 2012 server?
    There are some great reports in SCCM where you can check which Adobe products are installed on which computers, but I have yet to discover how to import them.

    Moving this discussion to the Creative Suite Enterprise Deployment forum.

  • Make the present transaction VL06 for report purpose only

    My client wants that the inquiry only vie wof transaction VL06/VL06o so that individuals who only need the reporting capability available in this transaction can get the reports they need without being able to access VL02N and other transactions such as LT03 and LT12.
    Kindly suggest how to proceed?

    Enter VL06 in field SHDTV-TCODE, ZVL06 in field SHDTV-TCVARIANT. Push 'create' and leave transaction VL06 (which pops up). In next popup 3rd button 'deactive menu function' is available. In addition, after saving the variant and re-entering in change mode, first button will give possiblity to deactivate functions.
    I assume, authority for LT03,... will not be given - by transaction variants forbidden buttons are inactive (or disappear - haven't checked for this transaction).
    Regards,
    Christian

  • System statistics for report purpose

    I have some statistics from the present a simple report to the manag. Among the things required are:
    1. How many users log in on a daily/weekly/monthly basis
    2. How many reports/letter/service requests are run on a daily/weekly/monthly basis
    3. What problems/errors occurred in the given period
    4. How much downtime occurred in the given period
    Can anyone please suggest the best way to go about it?
    Thanks

    For downtime, whoever is asking you for that detail needs to specify what is downtime for them. Database being down, applications tier not available, concurrent managers being down and stopping some critical business events, etc.
    Regards,

Maybe you are looking for

  • Can I use a wireless drive to store videos as I record them?

    My wife is thinking of buying an ipad Air with 128gb storage. However she needs to interview some people and record the interviews on video. I'm not sure whether 128gb is enough and wondered whether it was possible to have the video file automaticall

  • How to print the mirror image of a pdf file?

    Hi, Does anyone know if it is possible to print the mirror image of a pdf file? I could have sworn I have done this before in an older version of Acrobat. I am currently working with Adobe Acrobat 8.0 Professional. Thank you, Tina

  • Exchange server inbox issue

    My email inbox wont display.  the settings are correct and I can even send email from the phone, as well as see the sent folder.  Email wont come in and wont update.  Stuck, can anyone help?  Our IT, Samsung and calling Verizon have not worked yet. 

  • CVP Record Agent Greeting Failing

    I'm setting up the default Record Agent Greeting application with CVP 10.0, UCCE 10.0, Finesse 10.5.  I can dial the entry point number from Finesse and it goes to the ICM script.  I hear the message "Please select the greeting you wish to hear or re

  • Camera raw image opens with white blocked-out area on photo

    I have never seen or heard of this before but 2 of the 100+ images I have opened, in bridge AND in PS, both open with a white blocked-out area covering most of the image, like it had trouble loading. It did not take long or seem different from any ot