Use of user track in buckets of 48 hours for each month

I have an obligation to follow the use by the user in buckets of 48 hours for each month. For example, from midnight on 1st Oct, create buckets of 48 hours thanks to 23:59 on 31 Oct. For each user, how many times they use the system in each bucket 48 hours? I try to avoid PL/SQL, if I can so right SQL is preferred. Thank you very much in advance for your help.

Usage_Table (sample data)

ID User_Name Create_DateTime

This last 100 10/01/11 00:01:58
This last 101 01/10/11 01:02:31
102 user_B 02/10/11 14:44:32
This last 103 04/10/11 08:21:11
This last 104 04/10/11 03:10:20
105 user_B 05/10/11 12:50:30
106 and user_a 07/10/11 13:45:10
107 and user_a 07/10/11 18:22:08


Example of output

User_name From_DateTime To_DateTime Number_Of_System_Uses
This last 10/01/11 00:00:00 02/10/11 23:59:59 2
user_A 03/10/11 00:00:00 04/10/11 23:59:59 2
user_B 10/01/11 00:00:00 02/10/11 23:59:59 1
user_B 10/04/11 00:00:00 05/10/11 23:59:59 1
and user_a 10/06/11 00:00:00 07/10/11 23:59:59 2

Hello

JoeCO wrote:
... I tried the outer join, but did not see the number 0. I'll keep playing with it.

Sorry, my mistake. It was not nearly as simple as I said earlier. JOIN EXTERNAL means that all ranks of the cntr will appear in the result set at least once, but we need every line of cntr appear joining each month and user_name at least once, we can do with a partitioned outer join:

WITH     cntr     AS
(
     SELECT     2 * (LEVEL - 1) AS low_val
     ,     2 *  LEVEL     AS high_val
     FROM     dual
--     CONNECT BY     LEVEL     <= 16     -- Max buckets in any month
     CONNECT BY     LEVEL     <=  4     -- For testing only
)
,     got_month_start     AS
(
     SELECT     user_name
     ,     create_datetime
     ,     TRUNC (create_datetime, 'MONTH')     AS month_start
     FROM     t_usage
)
SELECT       u.user_name
,       u.month_start + c.low_val     AS bucket_start_date
,       u.month_start + c.low_val
               + 2
               - (1 / (24 * 60 * 60))
                         AS bucket_end_date
,       COUNT (u.create_datetime)     AS number_of_system_uses
FROM             cntr            c
LEFT OUTER JOIN      got_month_start  u  PARTITION BY ( u.user_name
                                , u.month_start
                                )
                         ON  ( u.create_datetime
                             - u.month_start
                             )     BETWEEN     c.low_val
                              AND     c.high_val
GROUP BY  u.user_name
,       u.month_start
,       c.low_val
ORDER BY  u.user_name
,       bucket_start_date
;

As you can see, I also moved the calculation of TRUNC (create_datetime, 'MONTH') in a subquery.
I only showed the frist 4 buckets, just to simplify somewhat the exit during the original trial. The result is:

`                                              NUMBER
                                                 _OF_
                                               SYSTEM
USER_N BUCKET_START_DATE   BUCKET_END_DATE      _USES
------ ------------------- ------------------- ------
user_A 10/01/2011 00:00:00 10/02/2011 23:59:59      2
user_A 10/03/2011 00:00:00 10/04/2011 23:59:59      2
user_A 10/05/2011 00:00:00 10/06/2011 23:59:59      0
user_A 10/07/2011 00:00:00 10/08/2011 23:59:59      0

user_B 10/01/2011 00:00:00 10/02/2011 23:59:59      1
user_B 10/03/2011 00:00:00 10/04/2011 23:59:59      0
user_B 10/05/2011 00:00:00 10/06/2011 23:59:59      1
user_B 10/07/2011 00:00:00 10/08/2011 23:59:59      0

user_C 10/01/2011 00:00:00 10/02/2011 23:59:59      0
user_C 10/03/2011 00:00:00 10/04/2011 23:59:59      0
user_C 10/05/2011 00:00:00 10/06/2011 23:59:59      0
user_C 10/07/2011 00:00:00 10/08/2011 23:59:59      2

Tags: Database

Similar Questions

  • After purchasing the cloud creative and used for 2 months (for example), so I don't use it for 3 months. How is it? I don't have to pay the tariff for each month, or is it possible to only pay when I use it again? To resume: if I use it for 5 months a

    After purchasing the cloud creative and used for 2 months (for example), so I don't use it for 3 months. How is it? I don't have to pay the tariff for each month, or is it possible to only pay when I use it again? To resume: if I use it for 5 months a year, I have to pay for only those 5 or 12 months?

    No, if you have a subscription according to the type of subscription, you will have to pay each month or year until that you cancel.

    If you think you would use the apps for only three months, then you will not need three months, then our month to month plan would be best for you because it can be cancelled at any time it does not come with an annual contract for more information see the link below

    Adobe - General conditions of subscription

    Kind regards

    Bani

  • Use: OLD and: NEWS in the triggers without oracle for each line

    I use Oracle 10 g.
    I want to insert a row in the table of the newspaper by each Witch of the query is executed on a table.
    And I want to insert on the line at a table of detailed log for each row changed in a query.
    I want to add modification date and time for each line in the two tables of the newspaper and I want it to be similar.

    So, I'm curious about using old and new variables without using for each row on the creation of the trigger. Is this possible?
    Or maybe I can score some variables static for this query (so sysdate will be the same and some of the Pavilion for the insertion of small newspapers)?
    Or maybe is there other ways to do it?

    LeopoldStoch wrote:
    But if I use sysdate in each trigger and it will update something as my sysdate 100000 lines will be different for different lines but I want it to be time and on the same date.

    Hi Leopold,

    Then today is your lucky day :-): sysdate is the same for all the DML. Even if it takes more than one second:

    SQL> create table rob
      2  ( id int
      3  , creation_date date
      4  )
      5  /
    
    Table created.
    
    SQL> create trigger t
      2  before insert on rob
      3  for each row
      4  begin
      5          :new.creation_date := sysdate;
      6  end;
      7  /
    
    Trigger created.
    
    SQL> set timing on
    SQL> insert into rob (id)
      2   select level
      3     from dual
      4  connect by level <= 10000
      5  /
    
    10000 rows created.
    
    Elapsed: 00:00:00.37
    SQL> set timing off
    SQL> select min(creation_date)
      2       , max(creation_date)
      3    from rob
      4  /
    
    MIN(CREATION_DATE)  MAX(CREATION_DATE)
    ------------------- -------------------
    07-05-2010 09:29:24 07-05-2010 09:29:24
    
    1 row selected.
    

    You can read more here: http://rwijk.blogspot.com/2008/07/sysdate.html

    Kind regards
    Rob.

  • How to use 3 users on the same win XP VM, but each user has his own office.

    Hello world

    I'm a student and my friend, we have a problem on our vmware project...

    WE WANT to THE LOG IN VCENTER WITH 3 OTHER USER (the user are defined in Active directory) AND EACH USER MUST LOG on to THE SAME VM AND BEING ABLE TO HAVE THEIR OWN OFFICE...

    our teacher said that it is a feature of vcenter...

    We have an esxi and vcenter on that apparatus operation, we also have our active directory and windows xp for users...

    We are looking for a solution for 3 days now and we're short on coffee so please help us ^^

    Thank you and have a nice day

    Hugo

    If you ask if there are three HARD drives on a VM xp, yes you can have.

    But if you ask if you have three HARD drives and which will have to allow users to connect at the same time it is not possible as stated above.

  • ACS5: method of different external authentication for each user account

    ACS4 I could specify a different external authentication for each user account. I'm trying to find a way to do the same thing to the ACS 5? When I go under identity in Access Services, I see the system requirement: username I can use to identify the user who logs in, so that I can directly to a source of different identity, but the separate political configuration for each user is very inconvinient and would require hundreds of policies, in our case.

    I was hoping that we can create a kind of attribute for each user. SysAdmin > Configuration > dictionaries > identity > internal users. I created the new attribute called 'Storage of identity' with the enumeration type, which has 4 values: internal, Entrust Token, Token RSA, counts AD and checked the box "add a political Condition." I can then go under each user and select the storage of identity for each user. But now I can't find where I can use under part of identity of an access policy. I can use it under "Group mapping" but that maps to one group and not to an identity store. I need to use it under the identity somehow, but I can't find how.

    Hello Roman,

    The attribute you created will be available when the user is authenticated through internel ID store, so that you cannot use to select the store ID.

    The best way to do this would be to use other attributes to differentiate the identity store.
    Allows you to create a sequence of identity store so that for each user, ACS will try to authenticate by using multiple identity store.

    For example, you can use these:

    Network status

    > End Station filter

    > Device filter

    > Devide filter Ports

    Here you can import filters from a file and it would therefore be more scalable.

    Hope this helps.

  • Request for each thumbnail EXR bridge if transparency should be used as transparent or alpha! WTF?

    Since the last update, the bridge behaves like photoshop with OpenExr files: he asks if the alpha should be used as transparency or alpha.

    And this for EACH file in a folder in the Bridge creates thumbnails. You just ruined my workflow with EXRs. Completelly. Imagine a folder with hundreds of animation EXR images. Bridge wants to create thumbnails and wonder hundrets of times how? What did you even think to this? Have you even thought about everything? Why oh why?

    Change this behavior immediately or give me a hack to work around. Please, I beg you!

    Hi Otto.

    We published a new version of Adobe Bridge (CC 2017) on 2 November 2016. The new version of version number is 7.0.0.93. This version is available for installation via the Adobe Creative Cloud application.

    Please try the new version and look for problems you encounter.

    You may need to update the creative cloud app and restart your computer to see the update patch.

    Kind regards

    Gerard

  • Error using nested for each activity group transform Oracle SOA 11 g

    I posted this problem in XML general forum section. I don't know if it was in the right place because the error occurs in a BPEL.

    Thank you for taking the time to post this thread.
    I created a XSLT transformation that runs on oxygen, but does not work in a SOA transformation activity.

    Given this XML-

    < country >
    < info enum = "CTRY" name = 'United States' States-total = "50" / >
    < enum = 'ST' index info = '0' sname = "New York" population = "8 244 910" / >
    < enum = 'ST' index info = '0' sname = "Chicago" population = "2 707 120" / >
    < info enum = "CTRY" name = 'Germany' States-total = "16" / >
    < enum = 'ST' index info = '1' sname = population "Berlin" = "3 469 910" / >
    < enum = 'ST' index info = '1' sname = population "Brandenburg" = "2 500 000" / >
    < / country >

    Work of XSLT in the oxygen-

    < xsl: template match = "/" >
    < country >
    [< xsl: for each group-select = "" countries / * ' group-starting-with="info[@enum='CTRY"] ">"
    < CountryInfo >
    < xsl: Call-template name = "ctry" / >
    < / CountryInfo >
    < / xsl: for each group->
    < / country >
    < / xsl: template >

    < xsl: template name = "ctry" >
    < name > country: < xsl: value-of select="@name"/ > < / name >
    districts of <>< xsl: value-of select="@total-states"/ > < / districts >
    < xsl: for each group-select = "current - group ()" group-by="@index" >
    < xsl: Call-template name = "States" / >
    < / xsl: for each group->
    < / xsl: template >

    < xsl: template name = "States" >
    < name of xsl: variable = "index" select="@index"/ >
    States <>
    < xsl: for each select = "current - group ()" >
    < name >
    < xsl: value-of select="@sname"/ >
    < / name >
    < / xsl: foreach >
    < / states >
    < / xsl: template >

    I get the desired oxygen - result

    < country >
    < CountryInfo >
    < name > country: United States of America < / name >
    < > 50 districts < / districts >
    States <>
    < name > New York < / name >
    < name > Chicago < / name >
    < / states >
    < / CountryInfo >
    < CountryInfo >
    < name > country: Germany < / name >
    < > 16 districts < / districts >
    States <>
    < name > Berlin < / name >
    Brandenburg < name > < / name >
    < / states >
    < / CountryInfo >
    < / country >

    In a transformation of Oracle, I get an error "cannot perform XPath expression. I have narrowed down the cause of the error. The error is caused by
    the nested for each group - using 'current - group ()' and 'group-by=@index '.

    < xsl: for each group-select = "current - group ()" group-by="@index" >
    < xsl: Call-template name = "States" / >
    < / xsl: for each group->

    Oracle does not throw an error if I use ' Country/info' instead of ' current - group () or group-starting-with, but this does not produce the desired result.
    because he needs to be grouped by "@index."

    Does anyone know why the Oracle processing activity is not able to use the nested < xsl: for each group-select = "current - group ()" group-by="@index" >?

    This error has been fixed by modifying .

    It seems that the XSLT for Oracle parser does not correctly XSLT 2.0. This is understandable since in 11g does not have full support for XSLT 2.0.

  • User name is not filled are in the table of user tracking.

    Hi all

    I use LMS 4.2 I activated the user tracking and I get the ip address, MAC address, host name in the table of user tracking. But enter username in the user tracking is not be filled. I even enabled get the username by guests in the areas of host NTS and ND in the acquisition of user tracking settings.

    Is there something else I have to configure in LMS in order to get the names of users in tracking user table?

    any comments will be appreciated,

    Thanks in advance,

    Rgds,

    Selva

    You must utility utility that integrates with LMS with AD to feed it with user names. Utility is a utility that allows to collect the usernames of PDCs Active Directory and Novell servers.

    To do this, you need to install utility in main domain controllers Windows and Novell servers. You can also install utility in an Active Directory server.

    For more details, see:

    http://www.Cisco.com/en/us/docs/net_mgmt/ciscoworks_lan_management_solution/4.2/user/guide/Admin/ut_du.html#wp1187865

    -Thank you

  • Newbie question - alternating scenes in order using an audio track?

    Hello

    I filmed a musical school on 2 different nights.  Stage left the opening night and just Stadium last night.  All I want to do is use left step my main video and the audio track, then switch right of the stage sequences as needed.

    Left of the scene is clearly the best audio track because I was closer to the piano.  However, at certain times, right Stadium has a better POV through the action onstage, accessories, etc.  They slightly sped through the night last too so I have a few audio challenges of synchronization when using the images on the right of the scene.

    Anyway, here's where I am lost.  What is a cam multi task?  Or use the video 1 & video 2 track, if so, how?  Or should I cut the left and right of the stage scene scenes independent and mount it on 1 video all in order?

    I am without PP6 terminology to locate this answer in the help section, but learned some other great things by looking at .  I have CS6 and am a former loser of Pinnacle Studio, uh, I mean the user.

    Please tell me the commands/functions, I need to learn this task.  Thanks in advance for your help.

    JM

    Oh, I tried that.  Definitely * not * a multicam project (except if you really want to tear your hair out!).

    Because the timing is different on the two nights I recommend the implementation of these two shows in their own distinct sequences.  Stage left will be your primary, finished, sequence and allows you to define the right of the stage video and audio to be on track 2 (you'll need audio for reference and you will sometimes even use it).

    Through the performance of the stage left and split the video to any points you * know * you'll want to use another camera angle.  Start with the scenes of 'must-use' and then go to the scenes 'like to use' - you will need to practice!

    Disable clips of the scene left you use (or drop the opacity to 0%).  You should leave them in place, however, for reference.  Find the corresponding scene on the sequence of the scene to the right.  Cut it out and paste it on track 2 of the same scene in the sequence of the scene to the left (bring audio along for the ride too).

    Here's where the magic 'edition' (read: crazy) is available in.  Finessse the entry points and each camera (you'll end up setting two of them) until you like the cut.  Sometimes, the clip of the scene right will be longer than the same scene on the camera of the scene to the left.  Sometimes, it will be shorter.  Cut your master timeline as needed; If the new right scene is longer, just lop off the stage from stage left.  If it is shorter, leave a space or drag the hidden a little scene.  The idea is to keep as "synchronized" as possible to the end.

    You'll quickly learn when you can (and I can't) cut the songs!  Depends on your individual sellers, but will quickly become apparent.  You will also notice small (sometimes not so subtle) changes in costume, hair and makeup, not to mention the value of decoration and lighting.  You can sometimes get around these.  Sometimes you have to sacrifice your change to hide.  If you're very, very lucky you will have turned in very high HD.  If so, feel free to re-align your shots (i.e., zoom or pan).  Out and then put it on a standard def DVD and it will look wonderful!

    Oh Yes... Another thing... the * next * time for that (and if you do successfully this time * will * be a next time!), turn in high definition and beg, borrow or steal a second camera.  Set the second on the back of the House (or somewhere, he can see the whole show).  Then, you can be free to actually follow the action with your primary camera knowing that there is an 'insurance' static shot that you will be able to synchronize to the top.  * Who * will be a multicam edition!

  • How to use the user with event loop event

    Hello

    I want to communicate between 2 VI, so I have a global variable (boolean) who gives the order to an event tool to run. The problem comes from the fact that event loop accepts no global variable, I found on the forum that I can use the user event. Of course, the second VI works normally when I push the button (boolean) in there to run the event loop. Please can someone explain me how to do this, I am a chemist.

    Thank you.

    You enter the receiver structure of event for the event you want to receive.

    To do this in two screws, you will have to share the user between them event reference.

  • I tried to write a script, the user can use. This return number file *.tiff associations back using the image viewer is caused each month.

    Original title: automation of file tiff without elevated rights association

    I tried to write a script, the user can use. This return number file *.tiff associations back using the image viewer is caused each month.

    Hi, Unclemarcus2002,

    You would be wiser to post on the Forum TechNet where there is COMPUTER experts.

    http://social.technet.Microsoft.com/forums/en-us/newThread

    Maybe using the ASSOC and FTYPE command in a script will do what you want? I think that these orders would also apply the association throughout the world, rather than on a per-user basis.

    ASSOC: http:

    FTPYE: http:

    Here is an example, that you can try.

    Let's say you have a text file called "foo.bar" and you want the extension .bar always open with Notepad. There is an association for text files, so get him by typing "Ftype | more' at the command prompt (it will make a major announcement). Finally, you'll see the line "txtfile". On mine, it's "txtfile=%systemroot%\system32\notepad.exe %1" without the quotes.

    First create your association: assoc .bar = FooBarText

    Now to assign your request to your file type association: ftype FooBarText=%systemroot%\system32\notepad.exe %1

    You should now be able to double-click the foo.bar file and it will automatically open in Notepad.

    If you already have a Microsoft Office Document Imaging association, I think that it should be relatively simple type of substitution. Use ftype /? for a little more help.

    http://community.Spiceworks.com/topic/119639-Windows-7-automate-file-assocations

  • Never use a user or a password to connect to Windows

    Ive never had to connect to my computer using a user and or the password I love how Im immdieately on my desktop ready to use my computer

    And your questiion?

    "Suggestions for a question on the help forums.

    http://support.Microsoft.com/kb/555375

    See you soon.

  • I added the user name to log on to the computer in the active directory after adding, I can't connect to the internal application by using the user name and password...

    Hello

    I added the user name to log on to the computer in the active directory after adding, I can't connect to the internal application by using the user name and password...

    Please give the solution

    What happens when you try to connect?

    If you are able to connect using the different account, try running gpupdate/force.

    If the problem persists, you can open the discussion on:

    http://social.technet.Microsoft.com/forums/Windows/en-us/home

    What is responsible technical issues forum.

  • When I create the domain user, I used option user must change when you first connect, but am unble to get this

    When I create the domain user, I used option user must change at the first logon, but am unble to get it.

    Hi RadhamAravind,

    Thanks for posting in the Microsoft Community.

    As you create a domain user, the question you posted would be better suited for the IT Pro TechNet public. I would recommend posting your query in the TechNet Forums to get help:

    Windows 7 security TechNet Forums

  • Can I use the Google Tracking Code hyperlinks?

    Can I use the Google Tracking Code hyperlinks?

    Yes. Only if the links are not assets Eloqua.

    Thank you.

Maybe you are looking for

  • Trouble with Safari after update OSX

    Hi all I have a MacBook Air in hands. End 2010.OSX Yosemite 10.10.5 Last night the program update asked to restart the computer after the update has been downloaded. I shut down the computer and restarted this morning. What I see now: Safari no longe

  • ios9.2.3 iPad 2 "home" button

    Hi, sorry to do this, but I don't know another way to let you know about a problem I have with the last update. The home button does not work since the update of my iPad 2.  Well, ok, this works if I double click.  If I double click, it shows the pro

  • Has anyone seen a fax USB modem that works with Windows Fax and Scan?

    So far I'm 0 for 2.  PC Fax modems seem to be a lost art.  A few months ago, I tried a USB fax modem and tested the receipt of the fax.  The modem answers the phone, the fax sender starts the transmission and... nothing happens.  Eventually, the send

  • Passing from a curve to a corner point [CC]

    I'm doing a path in After Effects. and I want to create a corner point after a smooth curve that was generated by pulling on the handles. I know that there is a way to do it simply by double-clicking on the vertex created after pulling the handles in

  • Add hosts with existing virtual machines for 'Greenfield' active DRS Cluster

    I'm currently involved in a project for the hypervisor 5.5 and vCenter. Existing are 2 physical servers with redundant everything and 8 SAS hot swap hard drive bays. Initially, 8 bays only 4 have been populated with hard drives. Hard disks have been