Need a group by clause for two varibles in one table

I can't find any way to merge two variables in a group by statement with both vertical and horizobtable output.
The statement I got for a vertical output is (in 10gR2):
select to_char(d.begin_interval_time, 'YYYY-MM-DD') as Datenumber,
w.wait_class as Type,
round(sum(w.total_waits)/1024/1024, 0) as "Tot-waits"
from dba_hist_snapshot d, dba_hist_bg_event_summary w
where d.snap_id = w.snap_id
group by to_char(d.begin_interval_time, 'YYYY-MM-DD'), w.wait_class
order by to_char(d.begin_interval_time, 'YYYY-MM-DD');
2010-02-28 System I/O 234567
2010-02-28 User I/O 34444
2010-03-01 System I/0 773777
But I wanted to have the following summary output in one SQL:
System I/O User I/O Idle Commit .... and so on
2010-02-26 3442322 344555 335455 5
2010-02-27 533222 2233 445455 2334
2010-02-28 3434444 244444 345555 39
2010-03-01 34444 55445 3444 534
Anyone have a idea?

Do you mean this?
SQL> select to_char(d.begin_interval_time, 'YYYY-MM-DD') as Datenumber,
  2  round(sum(decode(w.wait_class,'Concurrency', w.total_waits/1024/1024, 0)),0) as "Concurrency",
  3  round(sum(decode(w.wait_class,'System I/O', w.total_waits/1024/1024, 0)),0) as "System I/O",
  4  round(sum(decode(w.wait_class,'User I/O', w.total_waits/1024/1024, 0)),0) as "User I/O",
  5  round(sum(decode(w.wait_class,'Configuration', w.total_waits/1024/1024, 0)),0) as "Configuration",
  6  round(sum(decode(w.wait_class,'Other', w.total_waits/1024/1024, 0)),0) as "Other",
  7  round(sum(decode(w.wait_class,'Commit', w.total_waits/1024/1024, 0)),0) as "Commit",
  8  round(sum(decode(w.wait_class,'Idle', w.total_waits/1024/1024, 0)),0) as "Idle"
  9  from dba_hist_snapshot d, dba_hist_bg_event_summary w
10  where d.snap_id = w.snap_id
11  group by to_char(d.begin_interval_time, 'YYYY-MM-DD')
12  order by to_char(d.begin_interval_time, 'YYYY-MM-DD');
DATENUMBER Concurrency System I/O   User I/O Configuration      Other     Commit       Idle
2010-02-22           1        298          0             0          2          0       2107
2010-02-23           1        299          0             0          2          0       2114
2010-02-24           1        300          0             0          2          0       2121
2010-02-25           1        301          0             0          2          0       2129
2010-02-26           1        303          0             0          2          0       2136
2010-02-27           1        304          0             0          2          0       2143
2010-02-28           1        305          0             0          2          0       2150
2010-03-01           0        140          0             0          1          0        988Max
http://oracleitalia.wordpress.com

Similar Messages

  • Need to compare values in two columns of one table against values in two columns in another table

    Hi, as the title reads, I'm looking for an approach that will allow me to compare values in two columns of one table against values in two columns in another table.
    Say, for instance, here are my tables:
    Table1:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SEAN
    FEDCBA,SHAWN
    Table2:
    Server,Login
    ABCDEF,JOHN
    ABCDEF,JANE
    FEDCBA,SHAWN
    In comparing the two tables, I'd like my query to report the rows in table1 NOT found in table2. In this case, it'll be the 3rd row of table one:
    Server,Login
    FEDCBA,SEAN
    Thanks.

    create table Table1([Server] varchar(50), Login varchar(50))
    Insert into Table1 values ('ABCDEF','JOHN'),('ABCDEF','JANE'),('FEDCBA','SEAN'),('FEDCBA','SHAWN')
    create table Table2([Server] varchar(50), Login varchar(50))
    Insert into Table2 values ('ABCDEF','JOHN'),('ABCDEF','JANE'), ('FEDCBA','SHAWN')
    select [Server] ,Login from Table1
    Except
    select [Server] ,Login from Table2
    select [Server] ,Login from Table1 t1
    where not exists(Select 1 from Table2 where t1.[Server] = t1.[Server] AND Login=t1.Login)
    drop table Table1,Table2

  • Need to confirm actual time for 2 persons on one operation  in work order( PM)

    Need to confirm actual time for 2 persons on one operation  in work order( PM)

    Hi Abdullatif Siam,
    If you can move your discussion to the relevant space, possibility of people responding to you would be more..
    May be you move your post here -- Enterprise Asset Management --> http://scn.sap.com/community/eam
    BR
    Prabhith

  • Report for two sponsors on one project

    I would like to make report for two sponsors: Each of them want to see only a Cash flow (Budgeted Expense Cost and Actual Expense Cost) that is related to him/her.
    It is possible to do something similar in two ways:
    1. Activity Usage Spreadsheet - Spreadsheet Fields - Time interval - Cost - Budgeted Expense Cost and Actual Expense Cost
    2. Activity Usage Profile - Activity Usage Profile Options: Filter by bars/curver (Expenses); Show Bars/Curves (Budgeted and Actual)
    while Timescale: Show primary Dates (Type - Calendar; Date interval - Quarter/Months).
    But in both way Expenses are grouped together and it is not possible to differentiate who is financing what.
    Thanks!

    Yes, we are only replacing image files. So--since no one here
    is familiar with merge-- if we do as you suggest using Windows
    Explorer, the steps will be:
    1) One writer works on his/her computer's local drive and the
    other writer works on his/her computer 's local drive (no shared
    drive).
    2) Each writer creates an Image folder on his/her computer's
    local drive
    3) Each writer captures (Snag-it) images from the
    application, opens the captured image in Photoshop and sizes the
    new image file to match the size and width, border, etc parameters
    of the image in the current Help's HTML code. (writer will have to
    view HTML code to get image size)
    4) Each writer will copy the new image files into his/her
    local drive-based Image folder--giving the new image the same name
    as the image that is being replaced).
    5) The image files in the first writer's Image folder are
    then copied to the Image other writer's Image folder.
    6) The new Image folder containing all the new image files is
    copied into the RoboHelp source directory, overwriting the old
    Image folder.
    7) The writer with the new Image folder (containing all the
    new images) then generates and publishers the RoboHelp project.
    Is this correct?

  • HELLP!! NEED TO KNOW HOW TO USE TWO IPODS ON ONE COMP!ASAP

    i have an ipod nano and an itunes account. Now my mom has a nano and we need to know if you can register them on the same account and how or any other tips for using two ipods on one comp!
    PLEASE HELP ASAP!
    ZACH

    Hello Zach,
    There are a couple of methods for using more than one iPod on a single computer. Have a look at the article linked below. Method one is to have two Mac or Windows user accounts which by definition would give you two completely separate libraries. Method two is to set your preferences so each iPod is updated with only certain playlists within one library. Have a look anyway and see what you think and go for whichever you feel suits your needs best: How To Use Multiple iPods with One Computer

  • How to configurate system for two database under one server

    Hi Friends,
    I installed abd created A database by oracle 10GR4 in window 32 bit 2003.
    it works.
    Then i created other B database by DBCA under this server.
    When I shutdown immediate database.
    it works well. But I can not startup mount ot startup A database again,
    I got below message as
    SQL> startup mount;
    ORA-24324: service handle not initialized
    ORA-01041: internal error. hostdef extension doesn't exist
    SQL> startup;
    ORA-24324: service handle not initialized
    ORA-01041: internal error. hostdef extension doesn't exist
    SQL> startup;
    ORA-24324: service handle not initialized
    ORA-01041: internal error. hostdef extension doesn't exist
    From EM, I saw as
    A listen Status Up
    LISTENER
    Oracle Home          
    C:\oracle\product\10.2.0\db_1\BIN
    Location          
    C:\oracle\product\10.2.0\db_1\BIN\network\admin
    BUT agent connect Status          
    Failed
    Details          ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)
    A database instance down
    Host     salerpt.net
    Port 1521
    SID SALERPT
    Oracle Home C:\oracle\product\10.2.0\db_1\BIN
    Also I try to connect as
    SQL> connect sys/salel@salerpt as sysdba;
    ERROR:
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor
    Form EM, I saw listen start up.
    Then I stop it. then restart it
    I can saw B db listen and can not see A db listen.
    also
    I saw that other B database works.
    My listen info as***************
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1\BIN)
    (PROGRAM = extproc)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = SALERPT.NET)(PORT = 1521))
    I check physical, two database use one common bin directory .
    I do not have any experience to handle two database under one oracle server.
    How to check and configurate DB server system?
    Thanks for help.
    Edited by: user589812 on Jan 4, 2009 8:17 AM

    Jim,
    Before starting the database A, did you set ORACLE_SID=A from command line? You can run as many instances you want from single server provided you enough memory, processing power. Also try starting your instances usign window services and check and post some lines from alert.log for database A.
    tnsnames.ora entry
    DATABASE_A =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = salesrpt.net)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = DATABASE_A)
    DATABASE_B =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = salesrpt.net)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = DATABASE_B)
      )Regards
    Edited by: OrionNet on Jan 5, 2009 10:55 AM

  • Do i need  to buy an app for each device or one purchase.

    Do I need to buy pages app for every device or will one purchase do all my devices.

    One purchase for Macs and another for iOS devices. Note that if you're using a computer with Mac OS X 10.5.2, you'll need to either upgrade its OS or install the DVD version of iWork, which is separate from the Mac App Store version.
    (69166)

  • I need help figuring out how to Link Data from one table in Sharepoint to another table in Sharepoint and make it dynamic

    Hi Everyone,
    I am working on a project that uses SharePoint 2010 for repository and we have multiple tables that we are using.
    One table is a list of the various projects we are working on (workstreams)
    The other is a table with various notes and such, to include meeting notes for the various projects.
    Currently we are just copying the shortcut from the meeting notes table and adding it in as a link in the workstreams status table.
    I need to find out if there is some sort of way to make this process dynamic so that when a new note is added for, lets say workstream #1 in the notes table, it will automatically propogate into the notes link section for workstream #1.
    Is this even possible??
    And if so how would I do it
    I haven't done much with modifying SharePoint in several years, and would Truly appreciate any and all help with this.
    Thanks in advance
    IKE

    Hi IKE,
    According to your description, my understanding is that you want to create a link in the workstreams list linked to the associated item of the notes list.
    Assuming the workstreams list has  Title column and another column called “Note” used to linked to notes list, and the notes list has Title column and another column used to store note.
    Then you can create a workflow on the notes list with SharePoint Designer 2010, and in the workflow, using “Update ListItem” action. And in the workflow Start Options, select “Start workflow automatically when an item is created”.
    For the workflow action, you can set as the screenshot:
    For the string in the String Builder, you need to open an item of notes list, then copy the URL of the display form and paste here, the URL will look something like this:
    http://sp/Lists/notes/DispForm.aspx?ID=1&Source=http%3A%2F%2Fsp%2FLists%2Fnotes%2FAllItems%2Easpx&ContentTypeId=0x0100300025278693CE49A5E3A394B23AD9E1&IsDlg=1
    Now, you need to replace the ID of the item using [%Current Item:ID%], for example in the above link, delete the number 1 and add [%Current Item:ID%].
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Need to Create Search Help Based on Condtions from one table to another tab

    Hi All,
    I have a table like ZGROUP Which contains the data below
    Filed name Filed Name Filed Name
    ZGROUP ZTYPE ZTEXT
    Entries
    ABC P TEXT FOR
    C P SDFNSDFKLN
    DDDD PSG TEPRTPERERTWERT
    DEF P TEST
    FFFFF PSG
    SEF PS SDFSDFLASLDFNASDLFN
    XYZ PS TESTING
    Whree P is Product , PS- Point of Sales, PSG-Sales Group
    Now i am going to crate another ZPROUDCT TABLE
    FIELDNAME FIELDDESCRITPON
    PRODUCT PROD_DESC
    Entry
    abc pRELATED ENTRY
    My Questions
    1) ZGROUPS table has 3 kinds of data P, PSG, PS type records,
    1) In Table ZPROUDCT , I want to create search help only P records for Table Zproduct of the field Product FROM zGROUPS table
    2) In Table Zsales , I want to create search help only PS records from ZGROUPS table
    3) In Table ZPSG, I want to create search help only PSG records from table ZGROUPS
    is it possible to create search help from One Master Table(ZGROUPS) table to other tables based on conditions.
    Please help me.
    very urgent
    Regards,
    Raju

    if  <condition>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>
    SELECT <field>
             FROM <table>
             INTO TABLE i_tab
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'                  "function module to provide f4 help to sold-to-party
        EXPORTING
          retfield        = "XXXX"
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          dynprofield     = '<field name>'
          value_org       = 'S'
        TABLES
          value_tab       = i_tab
    endif.
    lkike this u can check the condition and selec the data from table and assign it into one internal table and then call the FM it will give the f4 help to particular field
    reward if helpful
    regards,
    Khan.

  • Compare two fields of one table in selection.

    Dear Experts,
    I want to compare two fields of a table and make selection according to this.
    Ex: simply i want to select the rows from table mard where mard-labst>mard-insme. Could you write me the code to make this selection.

    Yes, Thomas,
    Its working:
    Sample code:
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select matnr ernam
           into table itab
           from mara where brgew > mara~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Or,
    Try with inner join once.
    Its working: Sample code.
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select p~matnr q~ernam
           into table itab
           from mara as p
           inner join mara as q
           on p~brgew > q~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Thanks,
    Naveen.I

  • Do you need to purchase mountain lion for two computers

    i'm upgrading to mountain lion on my iMac and my Macbook pro. Do I need to purchase it twice?

    No. As long as Snow Leopard  10.6.8 is installed you can redownload for free. Or you can save the installer application to your Downloads folder BEFORE you install it the first time. You can then copy it to the other computer using a flash drive or other external drive. Then run the installer on the other computer. You can also do this:
    Make Your Own Mountain/Lion Installer
    1. After downloading Mountain/Lion you must first save the Install Mac OS X Mountain/
        Lion application. After Mountain/Lion downloads DO NOT click on the Install button.
        Go to your Applications folder and make a copy of the Mountain/Lion installer. Move
        the copy into your Downloads folder. Now you can click on the Install button. You
        must do this because the installer deletes itself automatically when it finishes
        installing.
    2. Get a USB flash drive that is at least 8 GBs. Prep this flash drive as follows:
      a. Open Disk Utility in your Utilities folder.
      b. After DU loads select your flash drive (this is the entry with the mfgr.'s ID and size) from the left
          side list. Click on the Partition tab in the DU main window.
      c. Under the Volume Scheme heading set the number of partitions from the drop down menu to one.     
          Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the
          partition scheme to GUID then click on the OK button. Click on the Partition button and wait until
          the process has completed.
      d. Select the volume you just created (this is the sub-entry under the drive entry) from the left side
          list. Click on the Erase tab in the DU main window.
      e. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the
          button for Zero Data and click on OK to return to the Erase window.
      f. Click on the Erase button. The format process can take up to an hour depending upon the flash
         drive size.
    3. Locate the saved Mountain/Lion installer in your Downloads folder. CTRL- or RIGHT-click on the installer and select Show Package Contents from the contextual menu. Double-click on the Contents folder to open it. Double-click on the SharedSupport folder. In this folder you will see a disc image named InstallESD.dmg.
    4. Plug in your freshly prepared USB flash drive. You are going to clone the content of the InstallESD.dmg disc image to the flash drive as follows:
      a. Double-click on the InstallESD.dmg file to mount it on your Desktop.
      b. Open Disk Utility.
      c. Select the USB flash drive from the left side list.
      d. Click on the Restore tab in the DU main window.
      e. Select the USB flash drive volume from the left side list and drag it to the Destination entry field.
      f. Drag the mounted disc icon from the Desktop into the Source entry field.
      g. Double-check you got it right, then click on the Restore button.
    When the clone is completed you have a fully bootable installer that you can use without having to re-download Mountain/Lion.
    Note: The term Mountain/Lion used above means Lion or Mountain Lion.
    As an alternative to the above (you still have to do your own download of Lion/Mountain Lion) you can try using Lion DiskMaker 2.0 that automates the process of Steps 2 through 4.

  • How to use one Bex Variable for two purposes in one query?

    Hi,
    I want to prompt for a UOM in a query. Then I want to use that one UOM variable to do 2 tasks in the query:
    1. Perform a UOM conversion on one restricted key figure (no filtering)
    2. Filter in a second restricted key figure (no conversion)
    How would I use a variable (or two?) to do this? I do not want to have 2 UOM prompts.
    Thanks!
    Gregg

    Oh, it all seems so easy now!  Hindsight 20-20...
    Solution was to create a new input ready variable for Unit.
    1. Restrict the key figures which need restricting using new variable
    2. For conversions, in BI backend us T-code RSUOM and create new conversion type associated with new variable. Then for each key figure needing conversion, set the conversion parameter to use the new conversion type.
    Between both 1 & 2 above, the same variable is used & thus prompted only once.
    Solution works perfectly.... as it should. Hope this helps someone else!

  • HT4436 How do I set up separate iCloud's and apple ids for two phones on one account?

    I just got a new iPhone and when they transferred my contacts at the store they also replaced my husbands contacts on his phone! Major mess...how do I get the two phones on separate clouds??

    To fix this, you need to migrate your data to a separate iCloud account.  Do not delete any data from either phone until this is done or it will also be deleted from iCloud and the other phone, and will be lost.
    When you do this any data you sync with the shared iCloud account such as contacts is merged and will appear on all devices connected to the account.  To fix this you both need to have separate iCloud accounts (you can continue to share the same Apple ID for purchasing from the iTunes and app stores). 
    Decide which iPhone will be keeping the current iCloud account.  On the one that will be changing accounts, if you have any photos in your photo stream that are not in your camera roll or backed up somewhere else save these to your camera roll by opening the photo stream album in the thumbnail view, tapping Edit, then tap all the photos you want to save, tap Share and tap Save to Camera Roll.  If you are syncing Notes with iCloud (Settings>iCloud>Notes>On), you will also need to email these to yourself in order to keep them.
    Once this is done, go to Settings>iCloud, scroll to the bottom and tap Delete Account.  (This will only delete the account from this phone, not from iCloud.  The phone that will be keeping the account will not be effected by this.)  When prompted about what to do with the iCloud data, be sure to select Keep On My iPhone.  Next, set up a new iCloud account using a different Apple ID (if you don't have one, tap Get a Free Apple ID at the bottom).  Then turn iCloud data syncing for contacts, etc. back to On, and when prompted about merging with iCloud, choose Merge.  This will upload the data to the new account.
    Finally, to un-merge the data you will then have to go to icloud.com on your computer and sign into each iCloud account separately and manually delete the data you don't want (i.e., deleting your husband's data from your account, and vice versa).

  • ITunes for two users on one Mac. Will iTunes 7 compute?

    iTunes experts!
    I am at it again with iTunes on the same topic I had back in June of 2006 (see thread link below). It would appear that upgrading to iTunes 7 snuffed my neat little set up, though everything still works with iPhoto.
    I've had iTunes 7 for a while now, but am just now trying to get the problem fixed. I reset the permissions to my iTunes library which I have in a shared folder (harddisk/users/shared/iTunes/iTunes Library). I toggled back and forth on my two accounts (mine and my girlfriends) to see that it was working again and it was! ... for about a minute, then it cut and read me the same message on her log on:
    "The iTunes library file is locked, on a locked disk, or you do not have write permission for this file."
    http://discussions.apple.com/message.jspa?messageID=2538271#2538271
    Isn't there a way that two users on a Mac can have access to the same iTunes library on iTunes 7. Please help!
    Gryphen

    ... okay, this was weird, but I half figured it out, and it half corrected itself... I think.
    I went back into the second user account and accessed the iTunes library alias I had put in the account (linked to the main library in the shared folder). It came up just fine. ... now everthing works fine.
    Before, I was just openning iTunes from the dock icon.
    I don't know if my verbage helped anyone understand anything, but hey, I have the same music, shopping cart, and playlists on both user accounts accessible without a need for syncing. I am happy.
    Adios!

  • SMARTFORMS: how to link two varibles in one line.

    Hi guys,
    I am experiencing a problem with SMARTFORMS.
    I have a string longer than 255 characters. I want to print it in a smartforms, but due to the limitation in the characters I have to separate the string in two strings.
    My question is the next, how can I put together in the same line the two variables?
    In the smart form I put someting like that:
    <i>var1.
    var2.</i>
    So, then the PDF appears something like that
    <i>content of varible1 is in this line
    content of variable 2 makes an not desired return carriage</i>
    and what i want is the next :
    <i>content of varible1 is in this line content of variable 2 makes an not desired return carriage</i>
    That is, all together without the return of carriable.
    Can anybody help me to solve this?
    Thanks a lot.

    Hi,
        Its too simple, just put both variables next to each other. like...
    <var1><var2>
    This will print continous order.You can even put fullstop in end( like : <var1><var2>. )
    FYI:
    If you want to give separators in between, then you can use. like ...
    for date,
    <month>-<date>-<year>
    This will display : 06-21-2007
    Reward points if helpful
    Regards,
    Seema

Maybe you are looking for