Rows as column heading

using oracle 10g
i need help for a report.
my table structure is as below with sample data
tbl_customer
============
customer_id | customer_title | customer_name
1     | Ms. | Nancy
2     | Mr. | Ram
3     | M/S | General Traders
4     | M/S | XYZ Traders
tbl_orders
==========
order_id | order_date | customer_id | amount
1     | 1-mar-09 | 1 | 1000
2     | 2-mar-09 | 1 | 500
3     | 3-mar-09 | 4 | 1500
4     | 3-mar-09 | 3 | 2000
5     | 4-mar-09 | 4 | 3000
6      | 5-mar-09 | 2 | 2500
i need output in the following format
date | order_id | General Traders | XYZ Traders | Direct
1-mar-09 | 1 | - | - | 1000
2-mar-09 | 2 | - | - | 500
3-mar-09 | 3 | - | 1500 | -
3-mar-09 | 4 | 2000 | - | -
4-mar-09 | 5 | - | 3000 | -
5-mar-09 | 6 | - | - | 2500
customers name with title as M/S should become heading for the columns and Ms. or Mr. comes under heading "Direct"
thank you.

search the forum for PIVOT
Here is one thread with some examples Re: Help for a query to add columns

Similar Messages

  • Row and column heading in cross tab report

    Hi Gurus,
    Is it possible to leave column headings and row headings in a crosstab report blank?
    Pooja

    Hi,
    You could either suppress the Column Headings by unchecking
    Tools-->Options-->Column Heading or Making the background color and the font color of the cell to be same ( gray ), thereby making it invisible, though it is actually there.

  • Column Header in 2 rows in report file but export to excel data only displays only bottom row of column header

    Post Author: blofrese
    CA Forum: Exporting
    I am using Crystal XI and need to output several columns worth of data. Do to so I attempted to have the data presented in 2 rows within the same section.
    Example:Page Header b contains:  7 columns  5 columns
    Details a contains:  7 columns  5 columns
    When exporting to excel data only I only see the bottom 5 column header info and all the detail data in the correct order. How do I get all the Headers to display on the export file?
    Thank you for your time.

    Post Author: jw1234
    CA Forum: Exporting
    I have the same problem. Have you find the solution yet??
    I'm trying to export as Excel data only and have 2 page header band. It only display the 2nd band with the bottom label. None of the 1st band shows up. 
    Page Header a contains:Report TitleDate Range
    Page Header b contains:Dept Name4 columns
    Please help. Thanks!

  • Row break + column header Question

    I've got two question i can't find out by myself.
    Question 1:
    I use a row break on the first column of my report. That workd correctly. But how do i get a line or a empety row after the break? I prefer a line...
    Question 2:
    I want to have an extra header above some columns. how to create that. A example:
    extra header 1 extra header 2
    column1 column2 column3 column4 column5 column6 column7
    hope someone can help me with this... tnx in advanced

    Hi,
    For your second question, you could create a custom template and put in the additional headers in there, under the 'Before Column Heading' section. I have done this with one of my reports where I simply copied the standard template and changed it to include the header information. This is an example of what I have in the Before Column Heading section for my custom template.
    <tr><th class="t18ReportHeader"#ALIGNMENT# colspan="4" style="font-weight:bold;text-align:center;">Progress Data </th></tr>
    <tr><th class="t18ReportHeader"#ALIGNMENT#> </th>
    <th class="t18ReportHeader"#ALIGNMENT# style="font-weight:bold;text-align:center;" colspan="4"> Header 1 </th>
    <th class="t18ReportHeader"#ALIGNMENT# colspan="5" style="font-weight:bold;text-align:center"> Header 2 </th>
    <th class="t18ReportHeader"#ALIGNMENT# colspan="4" style="font-weight:bold; text-align:center"> Header 3</th>
    HTH,
    Chandini

  • How to transpose Row to Column heading

    Hi,
    I have a table with following data.
    ID     COLUMN_NAME     COLUMN_DATA
    198     LAST_NAME     OConnell
    198     HIRE_DATE     6/21/1999
    198     JOB_ID     SH_CLERK
    198     FIRST_NAME     Donald
    198     DEPARTMENT_ID     50
    199     FIRST_NAME     Jennifer
    199     LAST_NAME     Whalen
    199     HIRE_DATE     9/17/1987
    199     JOB_ID     AD_ASST
    199     DEPARTMENT_ID     10
    I want to transpose the data in the field column_name as column heading and corresponding data in the field column_data as row under it.
    Thanks $ Regards
    Manisha

    If you have 11g, you can do this...
    With T As (
    select '198' ID ,'LAST_NAME' COLUMN_NAME ,'OConnell' COLUMN_DATA from dual union all
    select '198','HIRE_DATE','6/21/1999' from dual union all
    select '198','JOB_ID','SH_CLERK' from dual union all
    select '198','FIRST_NAME','Donald' from dual union all
    select '198','DEPARTMENT_ID','50' from dual union all
    select '199','FIRST_NAME','Jennifer' from dual union all
    select '199','LAST_NAME','Whalen' from dual union all
    select '199','HIRE_DATE','9/17/1987' from dual union all
    select '199','JOB_ID','AD_ASST' from dual union all
    select '199','DEPARTMENT_ID','10' from dual
    --End of sample data
    select ID,LAST_NAME,HIRE_DATE,JOB_ID,FIRST_NAME,DEPARTMENT_ID from T
    pivot (max(column_data) for
    column_name in ('LAST_NAME' as LAST_NAME,'HIRE_DATE' as HIRE_DATE,'JOB_ID' as JOB_ID,'FIRST_NAME' as FIRST_NAME,'DEPARTMENT_ID' as DEPARTMENT_ID))
    ID  LAST_NAME HIRE_DATE JOB_ID    FIRST_NAM DEPARTMEN
    198 OConnell  6/21/1999 SH_CLERK  Donald    50
    199 Whalen    9/17/1987 AD_ASST   Jennifer  10
    Elapsed: 00:00:00.00or if 10g or older
    With T As (
    select '198' ID ,'LAST_NAME' COLUMN_NAME ,'OConnell' COLUMN_DATA from dual union all
    select '198','HIRE_DATE','6/21/1999' from dual union all
    select '198','JOB_ID','SH_CLERK' from dual union all
    select '198','FIRST_NAME','Donald' from dual union all
    select '198','DEPARTMENT_ID','50' from dual union all
    select '199','FIRST_NAME','Jennifer' from dual union all
    select '199','LAST_NAME','Whalen' from dual union all
    select '199','HIRE_DATE','9/17/1987' from dual union all
    select '199','JOB_ID','AD_ASST' from dual union all
    select '199','DEPARTMENT_ID','10' from dual
    --End of sample data
    select * from (
    select id,
    max(decode(column_name,'LAST_NAME', COLUMN_DATA)) LAST_NAME,
    max(decode(column_name,'HIRE_DATE', COLUMN_DATA)) HIRE_DATE,
    max(decode(column_name,'JOB_ID', COLUMN_DATA)) JOB_ID,
    max(decode(column_name,'FIRST_NAME', COLUMN_DATA)) FIRST_NAME,
    max(decode(column_name,'DEPARTMENT_ID', COLUMN_DATA)) DEPARTMENT_ID
    from T group by id)
    order by ID
    PRAZY@11gR1> /
    ID  LAST_NAME HIRE_DATE JOB_ID    FIRST_NAM DEPARTMEN
    198 OConnell  6/21/1999 SH_CLERK  Donald    50
    199 Whalen    9/17/1987 AD_ASST   Jennifer  10
    Elapsed: 00:00:00.01Regards,
    Prazy
    Edited by: Prazy on Apr 5, 2010 3:32 PM
    Added sql for older versions

  • Selecting multiple rows using column header with checkbox in it.

    Dear All.,
    I am trying to select multiple rows with checkbox in column header but it doesnot works...
    Following is my codel
    <af:table value="#{bindings.xx.collectionModel}"
                          var="row"
                          rows="#{bindings.xx.rangeSize}"
                          emptyText="#{bindings.xx.viewable ? 'No data to display.' : 'Access Denied.'}"
                          fetchSize="#{bindings.xx.rangeSize}"
                          rowBandingInterval="1"
                          filterModel="#{bindings.xx.queryDescriptor}"
                          queryListener="#{bindings.xx.processQuery}"
                          varStatus="vs" partialTriggers="sbcSelectAll sbcChkFlag"
                          selectedRowKeys="#{bindings.xx.collectionModel.selectedRow}"
                          selectionListener="#{bindings.xx.collectionModel.makeCurrent}"
                          rowSelection="none" id="tCdMast" width="400"
                          columnStretching="column:c4" inlineStyle="height:200px;">
                  <af:column sortProperty="ChkFlag" filterable="true"
                             sortable="true"
                             headerText="#{bindings.xx.hints.ChkFlag.label}"
                             id="c2" width="55"
                             inlineStyle="#{row.ChkFlag ? 'background-color:#9CACC9;' : ''}">
                    <af:selectBooleanCheckbox simple="true" value="#{row.ChkFlag}"
                                              selected="#{row.ChkFlag}" id="sbcChkFlag"
                                              autoSubmit="true" immediate="true"/>
                    <f:facet name="header">
                      <af:selectBooleanCheckbox simple="true"
                                                autoSubmit="true"
                                                valueChangeListener="#{xxBean.onTableChkAllCheckChanged}"
                                                id="sbcSelectAll"/>
                    </f:facet>
                  </af:column>
    </af:table>
    Managed Bean
        public void onTableChkAllCheckChanged(ValueChangeEvent valueChangeEvent) {
            Boolean newValue =
                Boolean.valueOf(u.nvlString(valueChangeEvent.getNewValue(),
                                            "false"));
            Boolean oldValue =
                Boolean.valueOf(u.nvlString(valueChangeEvent.getOldValue(),
                                            "false"));
            if (newValue.equals(oldValue))
                return;
            int rowIndex=0;
            ViewObject vo = u.findIterator("xxIterator").getViewObject();
            vo.reset();
            while(vo.hasNext()){
              Row row;
              if(rowIndex==0)
                  row=vo.first();
              else
                  row=vo.next();
                 row.setAttribute("ChkFlag", newValue.booleanValue());
              rowIndex=1;
            u.addPartialTargets(tableDocuments);
        }Please help!!.
    Thanks & Regards,
    Santosh.
    jdeve 11.1.1.4.0

    Can you check this sample in the blog post?
    http://sameh-nassar.blogspot.com/2009/12/use-checkbox-for-selecting-multiple.html
    Thanks,
    Navaneeth

  • Lock rows and columns header in a table view report. It is possible?

    hi,
    I have a Dashboard that displays a report in "Table View" with many rows and columns.
    Is it possible to set a lock on the rows and columns like Excel?
    This would have blocked such headers that contain attributes and measures and to browse the report (eg with a scroll bar) had always viewed the headers.
    Can you help me?
    Thanks

    hi,
    please go through this discussion
    Re: SCROLL BAR to FREZZ HEADERS
    thanks,
    saichand.v

  • In BI Bex Query Designer output, dont want to have unit at column Heading..

    Hi
    I have a BI Bex Query Designer report showing output with Qty unit at Column Heading level. Even in KF's Text i didn't mention unit. I want unit to appear to column fields instead of column heading. Pls let me know how to do that.
    One more thing is: i have 2 reports exactly same except due date range is different. first report showing unit for each KF at the column heading level and for 2nd report showing column fields level... Surprising. Pls let me know what is the reason and how to control it.
    Thanks...

    Hi Harpal,
    Key figures can have scaling factors and units/currencies. Normally, units/currencies are displayed for every key figure, but not the scaling factors. If you activate the Display Scaling Factors for Key Figures, an additional header row is added to the row or column header. Information about the scaling factor and currency/unit appears in this additional header row, as long as it is consistent (for example, 1,000 EURO).
    For more information, You can go through
    http://help.sap.com/saphelp_nw04/helpdata/en/e0/52029f961aa84d869b9b20fa7f7646/frameset.htm
    Hope it helps & resolves your issue.
    Regards,
    Pavan

  • How to Merge ADF Table Column Header in ADF Table ?

    Hi All,
    We need to have ADF Table Column header to be "Merged",
    e.g :
    There are two columns Header : | Qty (Case) | Qty (Pack) |,
    can we customize it to display like this :
    | ----- Qty -------|
    | Case | Pack |
    where there are two rows in column header, the first one is "Merged".
    How can we do that ?
    Thank you very much,
    xtanto

    Hi Kelly,
    Thank you for your reply,
    Using Column Faced, Header I can format the header of one column Only.
    My requirement is to Merge header of two colums :
    | ----- Qty -------|
    | Case | Pack |
    'Case' &'Pack' is two different column, so I need to add one row on the header of the two colums, then 'merge' them, and add the word '----Qty----'.
    Is it possible ?
    Thank you,
    xtanto

  • Localization of CrossTab row and column label Crystal Report RPT file

    Dear all,
    Does anyone know how to support multiple locale texts (English and French) in CrossTab Row and Column Header labels and grand total labels? Is there a way to parameterize text objects CrossTab in one single Crystal Report RPT file to use some sort of locale resource file containing text string for different languages based on the users of RPT at runtime? The idea is to use one single RPT file to generate report for different locale text for CrossTab Row and Column abels and grand total labels  instead of creating RPT files per locale?

    Hi,
    Does the database have a column that identifies the language? If it does, then you could create two separate cross-tabs and place them in different sections and conditionally suppress the section depending on the language from the database.
    That's the only thing that can be done in my opinion.
    -Abhilash

  • Interactive report – column heading in multiple rows

    I am using interactive report. My question to the expert/guru&rsquo;s is: - How do I change column heading into multiple row with text wrap.
    For example:- My column heading is
    Is Employee Trained ? -------&gt; (single row display)
    I want to make it display like
    Is Employee
    Trained ? ------&gt; (Multi row display)
    Sagar

    Hi,
    What you could do is, disable the download csv function from IR (Interactive Report Attributes--> Search Bar-- Uncheck Download) and in the region header create a link and redirect it to another page which will have the csv report output.
    e.g. <a href="#"  onclick="javascript:redirect('f?p=&APP_ID.:3:&SESSION.::&DEBUG.:3::');"" >Download Report </a>
    Here I am redirecting the link to Page 3. On Page 3 create a sql report with the same query and make report template to csv. Thanks,
    Manish

  • How to join 2 rows under single column header

    i want to join 2 or more rows under a single column header. as shown "container details" is the column name with "h", "w", and "s" and the sub column names. so my header should contain all these four names and my 3 rows under h,w and s should be clubed under this container details.
    anyone help me out. thanks in advance.
    container details
    | h | w | s

    Bummer, I just tried the link (which I saved from a couple months ago) and it doesn't work. This was a great site for showing how to do various things in Swing. Sorry for the bad link. Maybe someone saved the sites info or knows where it may have moved. Dang...

  • How to display the column header in two rows?

    Hi Experts,
    I am using ALV_LIST_DISPLAY i neeed to display the column header in two rows.. How can i do that?
    Ex: purchase order i  need to display "purchase" in one row and "order" in second row.
    Thanks in advance,
    Sarath.j

    REPORT zpwtest .
    TYPE-POOLS slis .
    DATA : layout TYPE slis_layout_alv .
    CONSTANTS : c_len TYPE i VALUE 20 .
    TYPES : BEGIN OF ty_t100          ,
              sprsl TYPE t100-sprsl   ,
              arbgb TYPE t100-arbgb   ,
              msgnr TYPE t100-msgnr   ,
              text  TYPE t100-text    ,
              fline TYPE t100-text    ,
            END OF ty_t100            .
    TYPES : BEGIN OF ty_wrd   ,
             text TYPE char20 ,
            END OF ty_wrd     .
    DATA : it_t100     TYPE TABLE OF ty_t100 ,
           it_sentence TYPE TABLE OF ty_wrd  ,
           wa_t100     TYPE ty_t100          ,
           wa_word     TYPE ty_wrd           ,
           v_repid     TYPE syst-repid       ,
           v_tabix     TYPE syst-tabix       .
    DATA : it_fld TYPE slis_t_fieldcat_alv ,
           it_evt TYPE slis_t_event        ,
           wa_fld TYPE slis_fieldcat_alv   ,
           wa_evt TYPE slis_alv_event      .
    INITIALIZATION .
      v_repid = sy-repid .
    START-OF-SELECTION .
    * Get data
      SELECT *
        INTO TABLE it_t100
        FROM t100
       WHERE sprsl = 'EN'
         AND arbgb = '00' .
      LOOP AT it_t100 INTO wa_t100 .
        v_tabix = sy-tabix .
        CLEAR : it_sentence .
        CALL FUNCTION 'RKD_WORD_WRAP'
             EXPORTING
                  textline  = wa_t100-text
                  outputlen = c_len
             TABLES
                  out_lines = it_sentence.
        IF NOT it_sentence IS INITIAL .
          READ TABLE it_sentence INTO wa_word INDEX 1 .
          wa_t100-fline = wa_word-text .
          MODIFY it_t100 FROM wa_t100 INDEX v_tabix .
        ENDIF.
      ENDLOOP.
    * Prepare fieldcatelog
      CLEAR wa_fld .
      wa_fld-fieldname = 'SPRSL' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'SPRSL' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'ARBGB' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'ARBGB' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'MSGNR' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'MSGNR' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'FLINE' .
      wa_fld-inttype      = 'CHAR' .
      wa_fld-outputlen = 20 .
      wa_fld-intlen    = 20.
      wa_fld-seltext_l = 'Text' .
      wa_fld-ddictxt = 'L' .
      APPEND wa_fld TO it_fld .
    * Get event.. we will handle BOFORE and AFTER line output
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           IMPORTING
                et_events = it_evt.
      READ TABLE it_evt INTO wa_evt
      WITH KEY name = slis_ev_after_line_output .
      wa_evt-form = slis_ev_after_line_output .
      MODIFY it_evt FROM wa_evt INDEX sy-tabix .
      READ TABLE it_evt INTO wa_evt
      WITH KEY name = slis_ev_top_of_page .
      wa_evt-form = slis_ev_top_of_page .
      MODIFY it_evt FROM wa_evt INDEX sy-tabix .
      layout-no_colhead = 'X' .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = v_repid
                it_fieldcat        = it_fld
                is_layout          = layout
                it_events          = it_evt
           TABLES
                t_outtab           = it_t100.
    *       FORM top_of_page                                              *
    FORM top_of_page .
        uline .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line1'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line2'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line3'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
    ENDFORM.
    *       FORM AFTER_LINE_OUTPUT                                        *
    FORM after_line_output   USING rs_lineinfo TYPE slis_lineinfo .
      CLEAR : it_sentence ,
              wa_t100     .
      READ TABLE it_t100 INTO wa_t100 INDEX rs_lineinfo-tabindex .
      CHECK sy-subrc = 0 .
      CALL FUNCTION 'RKD_WORD_WRAP'
           EXPORTING
                textline  = wa_t100-text
                outputlen = c_len
           TABLES
                out_lines = it_sentence.
      DESCRIBE TABLE it_sentence LINES v_tabix .
      CHECK v_tabix > 1 .
      LOOP AT it_sentence INTO wa_word FROM 2 .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               31 sy-vline    ,
               37 sy-vline    ,
               38 wa_word-text ,
               58 sy-vline .
      ENDLOOP.
    ENDFORM .

  • How do you freeze a row or column which is not a header in Numbers '09?

    Just wondering if anyone has worked out how to freeze a chosen row or column? I know you can do it with header rows, but the row I want to freeze is row 4. I'm using Numbers '09.
    And is it right that you cannot link cells between different documents in Numbers, as I used to in Excel?
    All help much appreciated!

    Using Numbers you cannot reference a cell in another document.
    I do not think you can freeze non-header rows.  You can make up to 5 rows part of the header:
    Then freeze the headers.

  • Select row and column from header in jtable

    hello i have a problem to select row and column from header in jtable..
    can somebody give me an idea on how to write the program on it.

    Hi Vicky Liu,
    Thank you for your reply. I'm sorry for not clear question.
    Answer for your question:
    1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
    * I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
    2. the picture for detail of my report
    Detail for Red number:
    1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
    espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
    2. tb_TOTAL1 group on item_part = 1
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
    3. tb_TOTAL2 group on item_part = 3 or item_part = 4
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
    4. tb_TOTAL3 group on item_part = 2
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
    5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
    expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
    I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
    My custom code:
    Dim Shared prev_close As Double
    Dim Shared now_close As Double
    Dim Shared now_open As Double
    Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
        now_close = TOTAL3 + NowOpening
        prev_close = now_close
        Return now_close
    End Function
    Public Function GetOpening(Month as String,NowOpen as Double)
        If Month = "1" Then
            now_open = NowOpen
        Else    
            now_open = prev_close
        End If
        Return now_open
    End Function
    Thanks alot for your help!
    Regards
    Panda A

Maybe you are looking for

  • Sound from internal Speakers.

    I was listening to music on an external speaker (plugged in through the headphones port); when i unplugged it, the headphones port lit up red from inside and the built in speakers didn't take over. I can't change its volume. I tried changing my sound

  • WLC 2504 with AP 3502

    Hello all, i need your help, i have a WLC but AP's not joined with controller,  this errors sends: cisco AIR-CAP3602I-N-K9    (PowerPC) processor (revision A0) with 167926K/81920K bytes of memory. Processor board ID FTX1734GJ9E PowerPC CPU at 800Mhz,

  • BLOB data type. Will it be available in BO XIR4?

    Hi, Does any know if we will be able to use BLOB data type in the new coming release of BO? Currently the only way you can use images is copying your image files physically to a folder because BO doesn't recognize BLOB data type from the database. Is

  • Error Message NSURLErrorDomain error -1012.

    I get this error message when I try to update.  I had just downloaded Safari Version 7.0.4 update 2 days earlier.  What can I do to resolve the issue?

  • "Media offline" - when it's not, and presets missing!

    I'm working on a project in PP CS5 (Mac) which has footage from a Canon DSLR and a AVCHD camera. I opened it and all of the AVCHD footage is shown as "media offline" even though the .MTS files are all in the same place as they were when I was previou