How to aggregate groups on a timeline

Hi
I have a table with rowdata based on time.
I want to COUNT(*) multiple occurrences, while the charge is the same.
If tcharge is changed a new group count() is started.
The groups must be in the same sequence as the loggdate.
Example:
select LOGGDATE_HEAD,CHARGE from PHF_VIEW order by LOGGDATE_HEAD;
LOGGDATE_ CHARGE
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064708
13-JAN-08 CN064708
13-JAN-08 CN064708
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064707
13-JAN-08 CN064709
13-JAN-08 CN064709
13-JAN-08 CN064709
13-JAN-08 CN064709
13-JAN-08 CN064707
13-JAN-08 CN064707
The information should be presented like:
CHARGE COUNT(*)
CN064707 4
CN064708 3
CN064707 5
CN064709 4
CN064707 2
Any suggestions?

SQL> create table phf_view (loggdate_head,charge)
  2  as
  3  select to_date('13-01-2008 01:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
  4  select to_date('13-01-2008 02:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
  5  select to_date('13-01-2008 03:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
  6  select to_date('13-01-2008 04:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
  7  select to_date('13-01-2008 05:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064708' from dual union all
  8  select to_date('13-01-2008 06:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064708' from dual union all
  9  select to_date('13-01-2008 07:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064708' from dual union all
10  select to_date('13-01-2008 08:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
11  select to_date('13-01-2008 09:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
12  select to_date('13-01-2008 10:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
13  select to_date('13-01-2008 11:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
14  select to_date('13-01-2008 12:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
15  select to_date('13-01-2008 13:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064709' from dual union all
16  select to_date('13-01-2008 14:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064709' from dual union all
17  select to_date('13-01-2008 15:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064709' from dual union all
18  select to_date('13-01-2008 16:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064709' from dual union all
19  select to_date('13-01-2008 17:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual union all
20  select to_date('13-01-2008 18:00:00','dd-mm-yyyy hh24:mi:ss'), 'CN064707' from dual
21  /
Tabel is aangemaakt.
SQL> select charge
  2       , count(*)
  3    from (  select charge
  4                 , sum(new_group_indicator) over (order by loggdate_head) grp
  5              from ( select loggdate_head
  6                          , charge
  7                          , case lag(charge) over (order by loggdate_head)
  8                            when charge then 0
  9                            else 1
10                            end new_group_indicator
11                       from phf_view p
12                   )
13         )
14   group by grp
15       , charge
16   order by grp
17  /
CHARGE     COUNT(*)
CN064707          4
CN064708          3
CN064707          5
CN064709          4
CN064707          2
5 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • I want to copy video, cutaways and audio combined and use in another project. So far I can only copy the video clip or one of the other elements at a time. How do I group all of them?

    I want to group my  video clip with its audio and cutaway clips so that I can copy the segment and move it to another project. So far I can only move one element at a time. How can I group all the elements?

    You can select multiple objects in the timeline in the usual Mac way - hold down the shift key while you click on the objects then copy, select other project, position playhead where you want to insert then paste.
    Geoff.

  • IN Premiere Pro CC how can I group copy all files in time line to another part of the time line

    How can I group copy all files from one part of the timeline to another part

    From the Premiere Pro manual (I believe track targeting matters, too.  That is, the targeted tracks only are copied): 
    Copy command enhanced to operate on a range in a sequence
    The existing Copy command (Edit > Copy, Ctrl+C (Windows), Command+C (Mac OS)) is enhanced when used in the Timeline panel. If there are no clips or keyframes selected, and an In Point or Out Point is set, then the range of time between the In point and Out point is copied to the clipboard.

  • How to aggregate a column based date column (for weekly single row)?

    How to aggregate a column based date column (for weekly single row)?

    Hi,
    Consider the below statement for daily bases which is ok
    SELECT ID, DATE, SUM(AMOUNT) FROM TABLE_NAME GROUP BY ID, DATE ORDER BY ID, DATE
    The same like the above statement, I want output on weekly, fortnightly, and monthly bases, How to do this? Need your help...

  • How do I play a symbol timeline from the main timeline

    Ive created a box, turned it into a symbol called box,
    Inside box i have a left to right animation with auto play turned off.
    I then went back to the main stage, clicked the box, added action, on click to play, yet it does nothing.
    How do i Play the symbols timeline?

    On click handler for the symbol use
    sym.getComposition().getStage().getSymbol("nameofsymbol").play();
    or
    sym.getSymbol("nameofsymbol").play();
    replace the italics with the literal name of the symbol as it appears in the Elements panel.
    Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
    Darrell

  • Imported CD songs are each put into a separate album. How can I group them in one album?

    Imported CD songs are each put into a separate album. How can I group them in one album?

    Look at Steve MacGuire's helpful article:  http://samsoft.org.uk/iTunes/grouping.asp

  • How to aggregate the PO history in batch

    How to aggregate the PO history in batch? thanks !

    I know this transaction,but it can't select all items to aggregate,i must select one item and aggregate, so it is not very convenient,so i write a program to batch process it
    Thansk!

  • How do I group the responses in a single cell...

    Hello,
    I have created a form in FormCentral.  The form is broken down into several groups of checkboxes.  Each group has a heading such as: 5 years old, 6 years old, 7 years old, etc...
    With the form created using FormsCentral, exported as a PDF (to add calculations) and then imported back into FormsCentral the grouping remain intact in the 'View Responses' area.  Example: The '6 years old' section displays the name of all of the 6 year old selected checkboxes.  The '7 years old' section displays the name of all of the 7 year old selected checkboxes, etc...
    Because the FormsCentral application doesn't provide a great deal of visual customization I am now trying to create my form using InDesign CC.  Now, the items take up their own spreadsheet column and don't group together inside the 'View Responses' area as before.  My question is: how do I group together item in the PDF so that they retain their grouping within FormsCentral as before? 
    My belief is that it has something to do with the naming conventions used on the various checkboxes.  Yet, I cannot quite figure out the pattern. 
    Any help is greatly appreciated.
    Thanks!
    -David

    Hi,
    >>My question is: how do I group together item in the PDF so that they retain their grouping within FormsCentral as before?
    Please try to rearrange your columns in FormsCentral View Responses table. You can select a column (or columns) and move it next to another column, then select the "T" icon which stands for "Text" formatting in Toolbar, here you can change the title of the Column or the text in each responses to a different color/background color.
    Hope this helps,
    Thanks,
    Lucia

  • How to remove group in XML Publisher template

    Hi All,
    How to remove group in XML Publisher template while desining as below is one example in that i want to remove the group no 2,3,4 or G Supp Seq,List G Audit,G Audit and want the output of line no 1 and 5 and then 1 or Batch / Entry/ Category/ List G Supp Seq/C Line No / C Transaction / C Document//C Credit/C Debit/C H Seq Name.
    Example:
    1) Batch / Entry/ Category/ List G Supp Seq                    /C Credit/C Debit/C H Seq Name                    
    2)          G Supp Seq
    3) List G Audit
    4) G Audit     
    5)     C Line No / C Transaction / C Document
    Kindly help how to generate the output without the line no 2,3,4.
    Regards,
    Sushant

    Sushant,
    you can try to design the RTF by Regrouping the XML data based on your requirement then you may get proper order.
    Please see the Regrouping XML concept in the user guide.
    Regards,
    Prasad Raju

  • How to set group contacts in nokia asha 305

    how to  set group contacts  in nokia asha 305....thank u......

    Can Some one Tell same group contact creation for ASHA 308 too?

  • HOW CAN I GROUP AND DELETE TEXT MESSAGES IN BULK

    HOW CAN I GROUP AND DELETE TEXT MESSAGES IN BULK

    message - edit - select each text message - delete.
    that is the only method to delete message on your iphone.

  • How to use GROUP BY  in ODI

    how to use GROUP BY in ODI tool

    Hi ,
    you can combine the insert stamt with the select ....so that in the target u will get a single line .....
    SQL> select * from prop_details;
    PROPERTY RELAVANTD NOTICES
    10100 25-JAN-09 30
    10100 03-JAN-09 30
    10100 02-DEC-08 20
    10100 01-DEC-08 10
    10100 31-DEC-08 20
    10101 10-JAN-09 10
    10101 20-JAN-07 15
    10101 30-DEC-08 45
    10101 20-FEB-08 35
    10101 31-JAN-09 25
    10 rows selected.
    SQL> select PROPERTY,max(RELAVANTDATE),SUM(NOTICES) from PROP_DETAILS GROUP BY P
    ROPERTY;
    PROPERTY MAX(RELAV SUM(NOTICES)
    10101 31-JAN-09 130
    10100 25-JAN-09 110
    SQL>

  • How to order / group a report by a placeholder column ?

    How to order / group a report by a placeholder column populated by the group filter ?
    In more detail .....
    My Data model editor's select statement brings back (say 1000 rows) from the database.
    The group filter decides (on performing certain validations) whether to print a row or not in the report.
    Additionally the group filter calculates a "rule type" (just a rule number to say on basis of what rule, the row was selected)
    I would like to order/group the report on the placeholder column which was calculated by the group filter ?
    Obviously, I won't be able to add the "ORDER BY :CP_RULE_NUMBER" in the sql statement as the placeholer column cp_rule_number
    is determined by the group filter level only. (If I do, I get a frequency error)
    Any ideas ?
    Thanks in advance.
    Edited by: user553361 on 8/10/2008 17:35

    how is the group filter implemented?
    If its pure PL/SQL, what about putting the filter-procedure in a stored function into the database? Then you could use the group filter in your query.

  • How to send group emails from ipad

    How to send group emails from ipad

    Thanks.  So matters haven't changed.  Ipad and iohone systems still not make use of the groups created in OSX Contacts, although one can "see" the groups synced through iCloud.  They just do not function as real distribution lists in Mail.
    With the Mailshot app, one creates Mailshot groups with Mailshot group name.  It's as smooth as a work around can get.
    Silly that Apple iOS folks never got around to connecting the contact groups now listed in iOS Contacts through iCloud syncing to also be fully functional in iOS Mail for the purpose of group emailing. 

  • HT3529 how to send group messages in ios 7.0.2

    please tell me how to send group messages in iphone 5 with ios7.0.2

    Oh yeah, now I remember that.
    But I also remember that you had to go all the way to the start of the message to gain access to the current contact information. Where as in iOS7 that button you mentioned is the contact information. Personally I perfer iOS7. I don't delete my messages, so this is better for me.
    However, it wouldn't be a bad idea to add an Edit button in that sub menu that shows up when you touch the upper right button. Currently there are opitions for "Phone", "FaceTime" and "Information" on the contact.
    KOT

Maybe you are looking for

  • Does the HP Officejet 6500 E709n Series printer support eprint?

    I really like the ability to ePrint using my new printer. I want to be able to set up other printer models at other locations. How do I know what printers support ePrint? I have one printer the HP Officejet 6500 E709. Does it suppoort ePrint?

  • Trouble reinstalling ITunes

    While trying to reinstall ITunes on my HP Laptop I get the message - Service 'Apple Mobile Device' failed to start.  Verify that you have sufficient privilages to start system services!  What now??

  • Enter_qurery/execute_query... its very URGENT!!!!

    hi sir/madam, i have a problem with execute_query...ENTER_QUERY is working fine...But EXECUTE_QUERY not giving any response...the code written for both are given below... first trigger go_block(<block name); enter_query; second trigger go_block(<bloc

  • The video downloading is extremely slow after downloading Flash Player Active X (IE) and FP Plug-in

    I have Windows 7 on a 64-bit operating system, and have Firefox 19 and Internet Explorer 8. I tried installing Flash Player 11.6.602.171 from the Adobe Website and got an error message right at 47% download "can not contact reliable source." I also t

  • Robots.txt question?

    I am kind of new to web hosting, but learning. I am hosting with just host, I have a couple of sites (addons). I am trying to publish my main site now and there is a whole bunch of stuff in site root folder that I have no idea what it is. I don't wan