Rows to column issue

Hi all,
I have the following sql which calculates volume for a given month and displays the month as a column.
select cc_num
........., case
............when to_char(trunc(actvy_per_date,'MM'), 'MM') = '01'
.................then sum(cc_actual_vol)
.................else null
............end Jan_Vol     
........., case
............when to_char(trunc(actvy_per_date,'MM'), 'MM') = '02'
.................then sum(cc_actual_vol)
.................else null
............end Feb_Vol                
from table1 a
where actvy_per_date between to_date('2006/01/01', 'yyyy/mm//dd') and to_date('2006/12/31', 'yyyy/mm/dd')                         
group by cc_num, actvy_per_date
The output of this query looks like:
cc_num...... jan_vol........feb_vol
4666...........350
4666.............................240
4786...........100
4786 ............................166
4800...........600
4800.............................550
I want the output to look like:
cc_num...... jan_vol........feb_vol
4666...........350.............240
4786...........100.............166
4800...........600.............550
Is there any function or any way to do this?
Thanks

select
       cc_num
      ,sum ( decode ( to_char(actvy_per_date,'MM') , '01' , cc_actual_vol , 0 ) ) JAN_VOL
      ,sum ( decode ( to_char(actvy_per_date,'MM') , '02' , cc_actual_vol , 0 ) ) FEB_VOL
      ,sum ( decode ( to_char(actvy_per_date,'MM') , '03' , cc_actual_vol , 0 ) ) MAR_VOL
      ,sum ( decode ( to_char(actvy_per_date,'MM') , '11' , cc_actual_vol , 0 ) ) NOV_VOL
      ,sum ( decode ( to_char(actvy_per_date,'MM') , '12' , cc_actual_vol , 0 ) ) DEC_VOL
  from
       TABLE1
where
       actvy_per_date between to_date('2006/01/01', 'yyyy/mm/dd') 
                          and to_date('2006/12/31', 'yyyy/mm/dd')
group by cc_num

Similar Messages

  • Need help in solving conversion row to columns issue

    Hi friends
    I came across a strange situation/ problem. The problem is in one table say source_metadata
    I have 4 attribute
    matching_Table matching_columns source_table source_col
    OTREDW.PARTY_ALT_ID Src_key rcw Source_key
    OTREDW.PARTY_ALT_ID party_id rcw party_id_org
    otredw.individual SRC_KEY
    otredw.individual name rcw name_org
    otredw.individual name rcw name_mod
    otredw.wage_fact src_key
    otredw.wage_fact wages_tips rcw wage_tips_org
    otredw.wage_fact wages_tips rcw wage_tips_mod
    The matching tables and source table can be matched on src_key/source_key
    I need to fetch the values from the respective tables / columns in one query. I have just faint idea to the solution is use of PIVOT feature.
    The desired OUTPUT is
    PARTY_ID PARTY_ID_ORG Name name_org name_mod wages_tips wages_tips_org wages_tips_mod
    1111111 1111111 James James JamesR 1000 1000 2000
    I hope I have explained what I need. I will appreciate If anyone will be able to show me the way how to resolve this issue.
    Thanks
    Rajesh

    Thanks everone for sending me the answer but I think I am unable to explain my issue.
    The main issue is I am storing the name of the table and name of the corresponding column of the table under different columns of the table. How to fetch the data using a sql from these columns.
    EXAMPLE
    METADATA_TABLE
    table_name Column_name
    OTREDW.PARTY_ALT_ID PARTY_ID
    OTREDW.INDIVIDUAL NAME
    OTREDW.WAGE_FACT WAGES_TIPS
    How to write query to fetch the table_name and column_name from metadata_table and fetch the data from the respective tables mentioned in the table columns?
    I hope I was able to explain the question now.
    Thanks
    Rajesh

  • SSRS Report Freezing row and column while scrolling Issue

    Hello,
    I have created the report and i have freezed the row and column of the report while scrolling [To Freeze made the changes in tabulex property of the table "Keep Header visible while scrolling"] 
    meade the changes in the property [Advaned Mode]
    Fixed Data= true
    Keep Together=true
    Keep with group =After
    Report on new page=true
    When ever i will scroll down my report my all column headder will remains same. after that if i scroll to right my first freeded column headder will not display [group column or freezed row headder].
    COuld you please suggest me for the same issue.

    Hi Vinay,
    Based on my research, freezing row and column headers are different in table and matrix.
    In a table, if we want to freeze column header, we should make the changes in the first Static row group in Row Groups pane with Advanced Mode as you said. If we want to freeze row header, the table should have a group ahead, then we can enable “Repeat header
    rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    In a matrix, if we want to freeze column header, we can enable “Repeat header columns on each page” and “Keep header visible while scrolling” options in Column Headers in Tablix Properties dialog box. If we want to freeze row header, we can enable “Repeat
    header rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to accessing current row report column value in Lov Query?

    Hi,
    which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
    As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
    The following post (Re: Simulating a correlated sub query in lov
    is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
    I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
    Thanks for your help
    Patrick
    http://inside-apex.blogspot.com

    Hi Patrick,
    I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
    There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
    What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
    Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
    Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
    There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
    Regards
    Andy

  • How to increase the row and Column length of Bex query in EP Portal 7.3

    Dear All,
    Please let me know the process  to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Please  let settings to increase rows up 10000 and column 100 in one page.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • Warning: No new rows or columns because the axis is not input-ready

    Hello all,
    I have a planning application that plan against multiple years. This is done using a query that uses an analysis web item with its properties set to enable multiple new rows e.g. 2 new rows. Right now I have an issue whereby those 2 new rows will only appear if I restrict the report to a single year and if I were to select 2 or more years I get this warning message u201CNo new rows or columns because the axis is not input-readyu201D and those 2 rows will disappear.
    Anybody have any idea whatu2019s going on? Thanks.

    Hi,
    note 1149346 explains when new lines are possible:
    https://service.sap.com/sap/support/notes/1149346
    Regards,
    Gregor

  • Row to column mapping and  combining columns

    Hi
    I have one issue i want to concatenating some columns and map row as columns like below.I am giving one ex and have more than 1000 employees like this
    Example
    {Srno  Eno Ename job datestart}
    {1 01 jack------clerk------01-Jan-2008}
    { 2         01   jack-----snrclerk----01-Jun-2009}
    { 3         01    jack ---- officer------- 01-Jan-2010}
    I want to display the row to columan mapping like first row concatenated as col2 and second row for col2 column etc
    {eMpno------- col1 ------------------co12----------------------------------col3}
    {0101 jackclerk 01-Jan-2008---jacksnrclerk01-Jun-2009------01jackofficer01-Jan-2010}
    rgds
    ramya
    Edited by: user11243021 on Sep 7, 2010 5:21 AM

    with t as (
               select 1 srno,'01' eno,'jack' ename,'clerk' job,to_date('01-Jan-2008','dd-mon-yyyy') datestart from dual union all
               select 2 srno,'01' eno,'jack' ename,'snrclerk' job,to_date('01-Jun-2009','dd-mon-yyyy') datestart from dual union all
               select 3 srno,'01' eno,'jack' ename,'officer' job,to_date('01-Jan-2010','dd-mon-yyyy') datestart from dual
              ) -- end of data sample
    select  eno,
            max(
                case srno
                  when 1 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col1,
            max(
                case srno
                  when 2 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col2,
            max(
                case srno
                  when 3 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col3
      from  t
      group by eno
    EN COL1                      COL2                      COL3
    01 jack clerk 01-Jan-2008    jack snrclerk 01-Jun-2009 jack officer 01-Jan-2010
    SQL> SY.

  • How to Increase the Rows and Columns Size of Bex Query in Enterprise Portal  of SAP  7.3

    Dear All,
    Please let me know the process how to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Currently I am getting Only  4 columns and 10 rows in One Page .And I am getting 1,2 etc tabs for both row and column. So i want to increase the column length more than 100  and row length more than 10000.
    Please suggest me a suitable solution to over come this issue.
    Please find the Below screen shot.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • Row and column headings-how to print without them

    Currently Epson C64 and appleworks 6.2
    How can I print the spreadsheet without the row and column headings as there doesnt seem to be a place to choose whether to how or not
    Thanks for replies
    Whilst writing, too many instances of the coloured wheel rotating, nothoing showing on screen, suddenly whole sentences appear. Very irritating, so how can I stop this ?

    I'm glad the AppleWorks info was helpful.
    About the colored wheel issue: does this happen in all applications in which you are typing? Are you doing other things in that app at the same time. For instance, if Safari is one of the problematic apps, are you also downloading at the same time? I have seen this issue a few times - very rarely - and have found that a restart usually gets things back to normal. I'm not sure if this will be a helpful workaround for you, but it has had some success.

  • Pivot Table Row and Column extension OBIEE 11g

    Hi,
    I have pivot view report, I have 3 columns,
    1) User Name
    2) Date
    3) Login Count
    User Name will be row(Vertical)
    Date will be Column heading (Horizontal)
    Login Count Measures
    So I will get login Count of user wrt date.
    Now When I give Wide range of filter i.e, from 1st Jan 2010 to 31st Dec 2010.
    There is increase in row also column, when it reaches certain extent it gives error as *'Exceeded configured maximum number of allowed input records.'*
    How to change the limit? or there is any fix?
    Thanks,
    Satheesh

    Hi,
    I have also faced the same issue, i have solved by changing DefaultRowsDisplayed count in instance config file.
    <Views>
    <pivot table>
    <DefaultRowsDisplayed>75</DefaultRowsDisplayed>
    <pivot table>
    </Views>
    Paste that code (which i mentioned in my last post) in instanceconfig.xml before these tags
    </ServerInstance>
    </WebConfig>
    But remember you need to restart the presentation service once this is done....
    Thanks
    Deva

  • In BlackBerry Passport excel can a row and column be inserted?

    Do confirm if in BlackBerry Passport excel row and column can be insert.
    Carlos D'Souza

    You already asked this in another thread.  You can't add a row or column in Sheet to Go.  Sorry.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • Dynamic Table - Add rows and columns in same table

    Hi there,
    I wonder if someone could help please? I'm trying to create and table where a user can add both rows and columns (preferably with separate buttons) but am having trouble trying to figure out how to do this. Is it possible? If so how? I'm not familar with script but have found examples of seprate tables where you can add a row and then another table where you can add columns and essentailly want to merge the two but cannot make it work.
    Any help much appreciated!
    Thanks,
    Ken

    It is great example....you can learn the concepts there and apply....however you may have to think twice before you implement column adding dynamically....because the technique here is make copy of what we already have and reproduce it as a new item and this technique works great for rows as they all have every thing in common. But when it comes to columns it may have unique visible identity as column head and displaying repeatedly the same column head may not look good. Of-Course you can do few extra lines of code and change the column appearance based on users input each time. Situations where users need to add additional column is very unlikely (sure your requirement might be an exception).
    Key in allowing adding/removing instances is managing design mode settings under Object>>Binding>>....and select the checkbox "Repeat <subform/row/...> for Each Data Item" and then set Min, Max and Initial count values.
    Also you need to club your effots by using simple scipt with button clicks....
    for the example refered in URL you posted following is what I did to make the first table allow Adding/Removing Rows....
    1. Opened the form in LC designer.
    2. Add two buttons AddRow & RemoveRow right next to RemoveColumn
    3. For AddRow I used following JS code....
          Table1._Row1.addInstance(1);//that means any time this button is clicked a new instance of Row1 is added use _Row2 or Row3 based on your needs
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    4.  For RemoveRow I used following JS code....
         Table1._Row1.removeInstance(1);//Syntax is...<objectReference>.removeInstance(<index of the repeating object that needs to be removed>); //in this case since we used 1 alwasys second object from top gets deleted.
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    5. Now time to update settings at Object>>Binding tab and set "Repeat......" and also set Min, Max and Initial count as explained above.
         Those settings needs to be updated for Row1 (or your choice of row) of the table
    6. Set the Height to Expand of the Subform, where the table is housed....  this is done under Layout pallet
    7. Save the PDF as dynamic template and verify the results...
    If you still run into issues I can send you copy that works on my machine, but you need send me an email at n_varma(AT)lycos.com
    Good luck,

  • Exporting data in rows and columns and loading in RDBMS

    <p>I have a scenario wherein i want to export data from HyperionEssbase in <b>rows and coulmns</b> and <b>load it into</b><b>RDBMS</b>. I can load data into RDBMS using informatica if theflat file exported is in form of rows and columns.But when i exportthe file using Hyperion Essbase 9 i get it in from of alldimensions and then the fact value which is not how i want. I wantdata in relational from in flat file itself(row,column).</p><p>Looking forard to your suggestions..Thanks in advance..</p>

    <p>Thanks <b>willjordan</b> and <b>twakim</b> for yoursuggestions..</p><p> </p><p>I tried both the techniques and both worked...</p><p>With reference to the technique suggested by <b>twakim</b> , I was able to use that in Hyperion Essbase 9..But in myreal scenario the cube is in Hyperion Essbase 6.5.4.2..Can i usethis Custom defined functions in Hyperion Essbase 6.5.4.2..and ifso how as there is no concept of Analytical server there???</p><p> </p><p>Please help me in this issue???<br></p>

  • Row as Column

    <tt>Hi Exports,
    I have one doubt TO build the query.. i.e., how can i CHANGE the ROW AS COLUMN.. I wrote one query which returned the below output
    </tt>
        A          B           C           D
      224      88        
      224      98
      224                   56
      224                   34
      224                               24
      224                               12
    But i want the result like below
    A      B    C   D
    224  88  56  24
    224  98  34  12Kindly SOME one help me how can i get the result LIKE above
    Thanks
    Arun
    Edited by: Arun on Apr 7, 2011 9:29 PM
    Edited by: Arun on Apr 7, 2011 9:33 PM

    Arun wrote:
    If u don't mind give me your mail id ill post my table script and data's in detailPlease don't ask people for their email address. People offer their time here voluntarily, but they do have their own jobs to do and do not necessarily want to be contacted directly at their workplace as if they are a personal support centre for others.
    The forums offer a better service as you will get more than one person looking at your issue, so if you need to provide information, you should do this on the forums and, if necessary, you can anonymize the data or just provide some example data to demonstrate the issue you are having.
    You haven't given us much information to go on, so here's a starting point, similar to what Frank was talking about...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 224 as A, 88 as B, cast(null as number) as C,  cast(null as number) as D from dual union all
      2             select 224,98,null,null from dual union all
      3             select 224,null,56,null from dual union all
      4             select 224,null,34,null from dual union all
      5             select 224,null,null,24 from dual union all
      6             select 224,null,null,12 from dual)
      7  --
      8  -- end of test data
      9  --
    10  select max(A), max(B), max(C), max(D)
    11  from (
    12        select A, B, C, D
    13              ,row_number() over (partition by A,decode(B,null,1,0),decode(C,null,1,0), decode(D,null,1,0) order by B nulls last, C desc nulls last, D desc nulls last) as rn
    14        from t
    15       ) x
    16* group by x.rn
    SQL> /
        MAX(A)     MAX(B)     MAX(C)     MAX(D)
           224         88         56         24
           224         98         34         12
    SQL>I've had to assume the order of the data you want in the B, C and D columns based on what you showed as expected output. Remember that, unless you have something in your data to specify a particular order to it, then data doesn't necessarily have an order as it's just a set of data, so when it comes to combining rows as you want, some rule has to be applied to indicate which values get combined to a single row (in my example the max C and D values go with the min B value, and visa-versa; this is determined by the order by clause in the row_number() analytical function).

  • New tab page rows and columns problem

    Hi.
    After a recent update and making new tab links smaller, I've decided to increase number of rows and columns, put my most frequently used bookmarks in there and close bookmarks toolbar to improve visibility. Since yesterday (March 26 2014.) I lost my bottom row, although there is enough space on my screen. In about:config newtab section, it still says I'm having 6 columns and 5 rows, but I only get 4 rows when I open new tab. What might be the problem, and why did you make those newtab links smaller anyway?

    Hello,
    You're using Nightly, which is a highly experimental version of Firefox intended for testing. In the latest version, modifying the ''browser.newtabpage.columns'' and ''browser.newtabpage.rows'' preferences in about:config behaves as you describe (in my case, I actually only get 3 rows, presumably because of higher DPI settings). This issue has already been reported.
    * [https://bugzilla.mozilla.org/show_bug.cgi?id=988459 Bug 988459 - New-tab-page is not showing the defined number of tiles anymore]
    Please read the Bugzilla etiquette page before deciding to comment on bug reports.
    * https://bugzilla.mozilla.org/page.cgi?id=etiquette.html
    If you don't want to test a cutting edge version of Firefox and report issues with it, switch to the release version.
    * http://www.mozilla.org/firefox/all/

Maybe you are looking for

  • PDF file is not opening in ipad mini,pdf file does not show any containts in file ,tried all options , please suggest solution

    Hi Friends i am not able to read some of the important  pdf from ipad mini,pdf is opening but not showing any containts,i tried all suggestion priviously given in discussion forum (reinstallation,formatting,system upgrade,mailing pdf document  ) can

  • Safari 6.2.5 won't open

    Updated to Safari 6.2.5 using Mountain Lion (10.8.5). After restart, 6.2.5 won't open. Message says "6.2.5 may not be compatible with Mountain Lion. May have to reinstall Safari 6.2.5". What is the problem? How do you reinstall Safari? Thanks.

  • Question regarding Nokia Asha 309, pls. answer

    Hi , I'm new here. I was planning to buy a nokia asha 309 and I want to ask some things. -How is the performance in this phone? is it good? -how about the gaming? does it lag like the asha 305?? -how about the screen? is it responsive?? thanks, I hop

  • Where to find edited photos using the built in photo editor?

    So, I just upgraded my i4 to an i4S. I didn't get a chance to play around with the photo editing features of iOS5 on my i4, but I have found them REALLY useful now. I have edited a few photos on my i4S and hit the yellow "save" button. In the camera

  • Fonts don't print with Font Book

    Hi, Fonts I load in Font Book are looking fine on screen but they don't print - I have to put them directly in the Fonts folder (in the System folder) to do so. My printer is a Lexmark E120n is that matters. What should I do to get them to print usin