How to get the count for every 30 mins

Hi,
Following is the table format:
Time ******************** logged in users
9/5/2006 8:38:22 PM**** 2
9/5/2006 8:38:44 PM**** 4
9/5/2006 8:40:22 PM**** 1
9/5/2006 8:41:22 PM**** 3
9/5/2006 8:52:22 PM**** 6
9/5/2006 9:02:22 PM**** 5
9/5/2006 9:04:24 PM**** 3
9/5/2006 9:08:26 PM**** 4
9/5/2006 9:10:28 PM**** 6
What I need is number of users logged in for every 30 min
like 9/5/2006 9:00:00(8:30 to 9:00) is 16
9/5/2006 9:30:00(9:00 to 9:30) is 18
Can any one help me in this regard?
-Raj

The trick is to group your times to every 30 min.
Unfortunatly there is no way to TRUNC(30 min).
But you can build this function yourself using some mathematical logic and trunc to build the groups.
Look at this code piece:
select trunc(sysdate) + trunc((sysdate - trunc(sysdate))*24*2)/24/2
from dualInstead of sysdate use your date column and group by the expression.
Added example using Dave's test data
WITH t AS
        SELECT TO_DATE ('9/5/2006 8:38:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               2 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 8:38:44 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               4 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 8:40:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               1 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 8:41:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               3 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 8:52:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               6 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 9:02:22 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               5 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 9:04:24 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               3 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 9:08:26 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               4 num
          FROM DUAL
        UNION
        SELECT TO_DATE ('9/5/2006 9:10:28 PM', 'fmdd/mm/yyyy hh:mi:ss pm') tm,
               6 num
          FROM DUAL)
SELECT   SUM (num), trunc(tm) + trunc((tm - trunc(tm))*24*2)/24/2 halfhours
    FROM t
GROUP BY trunc(tm) + trunc((tm - trunc(tm))*24*2)/24/2;
Row#     SUM(NUM)     HALFHOURS
1     16     09.05.2006 20:30:00
2     18     09.05.2006 21:00:00Message was edited by:
Sven Weller

Similar Messages

  • How to get the Count for no.of.errors

    HI
    BELOW IS MY CODE
    LOOP AT I_RETURN INTO WA_RETURN.
      IF WA_RETURN-TYPE ='E'.
        CONCATENATE SOURCE-AUFNR '|' SOURCE-VORNR '|'WA_RETURN-MESSAGE
                                                         INTO TEXT.
        WRITE:/ TEXT.
        COUNTER = COUNTER + 1.
      ENDIF.
    IM GETTING BELOW O/P
    000090001366 0020 Enter another operation number
    000090001366 0020 Error  during processing of BAPI methods
    000090001366 0050 Item categories in agreement and requisition incompatible
    000090001366 0050 Error  during processing of BAPI methods
    NO.Of records In Error          4
    My Requirement is if AUFNR and VORNR value is same then the count should be 1 , Like the o/p should be
    NO.Of records In Error          2
    because AUFNR and VORNR is same for 2 records , can any one tel me the logic to do this,
    AUFNR and VORNR value is there in Internal Table

    Hi All,
    Thanks for the replies.
    AUFNR and VORNR are in different tables so im putting them in one internal table
    loop at itab into wtab.
        wtab-aufnr = wa_methods-objectkey.
        wtab-vornr = wa_operation-activity.
    endloop.
    now
    IF WA_RETURN-TYPE ='E'.
    now if aufnr and VORNR is same then i should get error message as said above
    can any one tel me the logic

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • Get the Count for each row

    I'm trying to get the count for each row to total count for each month
    Something like this
    Hardware     |      Jan
    Monitors       |       5
    Processors   |      137
    Printers        |      57
    etc........
    How can I write a query for this. I can get the Hardware column but don't know how to get the next column.

    If you can provide more data like sample input DML statements it would have been wonderful..
    Assuming is , you need a pivot. Here is an article on basic Pivot..
    http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
    something like this may be..
    DECLARE @Input TABLE
    Hardware VARCHAR(20),
    [Date] VARCHAR(20)
    INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
    , ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
    ;WITH CTE AS
    SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
    SELECT *
    FROM
    SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
    PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to get the order for these decoration​s?

    hello,
    I want to programatically resize all the controls, indicators and decorations on the front panel.
    I am getting the references of all the controls and indicators and able to resize them, as each n every control and indicator has a tabbing order set to it.
    I am also getting the references of all the decoration used on the front panel but not able to get the order.
    how to get the order for these decorations?

    The order of the decorations is the same as the back to front order. So you
    can change it by bringing decorations to front, or sending them to the back.
    It has been suggested many times that decorations should have labels as well
    as controls, but at the moment there is no way to tell which reference
    belongs to which decoration (besides position and order).
    Regards,
    Wiebe.

  • How to get wage type for every time record

    Hi Pros,
          I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?

    Hello,
    Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
    Thanks
    Abhishek Shanbhigue

  • How to get the "Key" for Dimension in SSAS.

    Hi
    How to get the "Key" for Dimension in SSAS.
    (Below value is the PPSParameters table XML column value in PPSDatabase in SharePoint.
    Below three key values are belongs to "Dimension". I have tried to find the key but I could net get it.)
    <NewDataSet>
    <UserValues><Key>16A201A9E75128559F947D58E6D187A9</Key></UserValues>
    <UserValues><Key>7FBEA449A6ED5606973306445839619E</Key></UserValues>
    <UserValues><Key>A8F75F9720817BCD2E1DFC1C1CF1E678</Key></UserValues>
    </NewDataSet>
    Thanks & Regards
    Poomani Sankaran

    To Be Honest there is not one straight Cmdlet that atleast I have come across 
    The best way would if you have Lync monitoring server 
    Using the Lync Server 2013 Monitoring Server
    If you have the Monitoring Server role configured in your environment, and for Lync Server 2013 everyone should!, you can use information contained in the LcsCDR database to pull back the last time a user signed in.  You can run the following query* to
    pull back the user's SIP URI and their last login time:
    USE LcsCDR
    SELECT dbo.Users.UserUri, dbo.UserStatistics.LastLogInTime
    FROM dbo.UserStatistics
    JOIN dbo.Users ON dbo.Users.UserId = dbo.UserStatistics.UserId
    ORDER BY UserUri
    Which produces the following output:
    The advantage to using the Monitoring Server to obtain this data is that unlike the information contained in the rtcdyn database, the information from the LcsCDR data will persist even when the user isn't signed into Lync.
    To get approx count of users enable for Lync Server in your organisation 
    Get-CsUser -Filter {Enabled -eq $true} | MeasurE
    Please not the above command let will give you an approx number not exact 
    From the Monitoring report yet the SIP account that signed in and then from count find out how many user havent signed in this is manual task 
    Hope this is helpful 
    Please remember, if you see a post that helped you please click ;Vote As Helpful" and if it answered your question please click "Mark As Answer" Regards Edwin Anthony Joseph

  • A^b = n ,How to get the value for a ?

    a^b = n ===> n = Math.pow(a,b)
    How to get the value for a ?
    dose Java have API to get the value for a ?
    Thanks for help~~~

    a^b = n
    =>
    a = n^(1/b)
    So,
    a = Math.pow(n,1.0/b)

  • How to get the date for the first monday of each month

    Dear Members,
    How to get the date for the first monday of each month.
    I have written the following code
    SELECT decode (to_char(trunc(sysdate+30 ,'MM'),'DAY'),'MONDAY ',trunc(sysdate+30 ,'MM'),NEXT_DAY(trunc(sysdate+30 ,'MM'), 'MON')) FROM DUAL
    But it look bith complex.
    Abhishek
    Edited by: 9999999 on Mar 8, 2013 4:30 AM

    Use IW format - it will make solution NLS independent. And all you need is truncate 7<sup>th</sup> day of each month using IW:
    select  sysdate current_date,
            trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month
      from  dual
    CURRENT_D FIRST_MON
    08-MAR-13 04-MAR-13
    SQL> Below is list of first monday of the month for this year:
    with t as(
              select  add_months(date '2013-1-1',level-1) dt
                from  dual
                connect by level <= 12
    select  dt first_of_the_month,
            trunc(dt + 6,'iw') first_monday_the_month
      from  t
    FIRST_OF_ FIRST_MON
    01-JAN-13 07-JAN-13
    01-FEB-13 04-FEB-13
    01-MAR-13 04-MAR-13
    01-APR-13 01-APR-13
    01-MAY-13 06-MAY-13
    01-JUN-13 03-JUN-13
    01-JUL-13 01-JUL-13
    01-AUG-13 05-AUG-13
    01-SEP-13 02-SEP-13
    01-OCT-13 07-OCT-13
    01-NOV-13 04-NOV-13
    FIRST_OF_ FIRST_MON
    01-DEC-13 02-DEC-13
    12 rows selected.
    SQL> SY.

  • How to get the ItemKey for a Workflow triggered by an event in Oracle Apps

    Hello,
    I have added a custom sub process to the seeded "OM Order Header" workflow. The process sends a notification. There are a few attributes in the body of the message tied to this notification, to which I am trying to assign values to using the syntax:
    SetItemAttrText (itemtype, itemkey, attrname, attrvalue).
    I have the internal names for the item type and attribute name, but don't know how to get the value for the item key. I understand the item key is supposed to be unique for each item type and is automatically generated by the workflow engine when the work flow fires. Is there a built-in function or some means to get this value?
    Regards,
    Smita

    Have you tried to query WF_ITEMS? -- http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=WF_ITEMS&c_owner=APPLSYS&c_type=TABLE
    bde_wf_item.sql - Runtime Data of a Single Workflow Item [ID 187071.1]
    Thanks,
    Hussein

  • Urgent:How to get the Sqltext for Oracle Sumbitted Jobs in 10g

    Dear All,
    Could you help me out in sorting the below problem.
    I use to get the current running sql's with following below query in 9i.
    SELECT A.SID,B.HASH_VALUE, OSUSER, USERNAME, SQL_TEXT
    FROM V$SESSION A, V$SQLTEXT B
    WHERE B.HASH_VALUE = A.SQL_HASH_VALUE
    AND USERNAME LIKE upper('%SCHEMA%')
    ORDER BY B.HASH_VALUE, B.PIECE;
    This is will work in 10g also for user-triggered sqls,stored procedures etc.
    But when oracle submits job i'm not able find which qurery is running.
    Seems For oracle jobs in 10g for V$session contain column SQL_HASH_VALUE as Zero and hence i'm not able find the any sql's running.
    Could you please any of you help me out how to get the Sqltext for Orcle submited Jobs in 10g.
    Please revert asap as this is very urgent for me.
    Thanks in Advance
    Anil.

    Have you tried to query WF_ITEMS? -- http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=WF_ITEMS&c_owner=APPLSYS&c_type=TABLE
    bde_wf_item.sql - Runtime Data of a Single Workflow Item [ID 187071.1]
    Thanks,
    Hussein

  • Anyone know how to get the templates for illustrator?

    Anyone know how to get the templates for illustrator?

    Apologies for the incomplete details. I am using Illustrator 2014. I saw the Adobe online training which have predefined templates which is missing when I installed the program. Thank you Larry for the answer.

  • HT4623 i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS

    i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS

    look at this thread
    https://discussions.apple.com/message/22837309#22837309

  • How to get the drivers for Dell PowerEdge M620 in INF format?

    How to get the drivers for  Dell PowerEdge M620.
    We tried downloading
    http://www.dell.com/support/home/us/en/19/product-support/product/poweredge-m620/drivers but they are in exe?
    How to get inf files for those?

    As Jason pointed out, they can be extracted, I believe this can be done with 7zip also... Or you can just install one M620 from scratch, install the Dell drivers and then use this tool:
    http://gallery.technet.microsoft.com/ConfigMgr-Driver-Injector-aae7d17d to grab the drivers in .inf format.

  • How to get the count of repeating elements in a xml doc.

    In many xml documents, in is common to have repeating child elements and what I would like to know is how do I determine exactly how many of these child elements exist in a particular document. There is probably a correct XPath string to determine this, but I cannot figure out what it is. Here is an example
    <a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>
    The above 'c' element is what varies in number from document to document and I need to know how to get the number of 'c' elements for the document, which would be 3 in the above case.

    create table test_xml(data xmltype)
    insert into test_xml values(
    xmltype('<a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>')
    select extract(data, '/a/b/c').getclobval() from test_xml
    select count(*) from test_xml
    where existsnode(data, '/a/b/c')=1
    good luck.

Maybe you are looking for

  • File and Printer Sharing problem

    Message Edited by bartman_60042 on 11-13-2007 05:47 AM

  • Delete old email address from cache on a MAC

    Has there been a solution to delete old email addrss from the cache on a MAC?  I'm not talking about iPhone or iPad devices.  The last discussion on this topic was back in 2012 and it doesn't look as if this was resolved. Bottom line, when you create

  • CC desktop app feature request: file sync progress

    In the CC desktop app under Assets > Files, when a file or files are syncing, I get a spinner with no indication of progress. Does progress exist and I'm just missing it? If no, an upload summary of files would be appreciated. Something like: Syncing

  • Delta Changes from CRM to ERP

    Middleware gurus, Our delta changes with the BPs from CRM to ECC are generating a "Message type     is unknown".  Has anyone ever seen this?  It works fine from ECC to CRM.  We're on CRM 5.0 and ECC 5.0. Does anyone have any clue???

  • What will it be ....

    http://www.bea.com/framework.jsp?CNT=all.htm&FP=/content/products/&WT.ac=topnav_products_products