Group by a fraction of time

Hi,
I have had a query that return the average of a value group by a date by hours. It works fine, but now I want to return the average by 15 minutes, or 2 hours; is it possible?
That is my query, it group by hour:
SELECT TRUNC(COL_DATE, 'HH24'), AVG(COL_VALUE)
FROM MY_TABLE
GROUP BY TRUNC(COL_DATE, 'HH24')
Thanks in advance.
Fernando.

You need to know two things. There is a date format mask SSSSS which gives us the number of seconds since midnight. There are 3600 seconds in an hour.
So, to get two hour chunks of a date...
SQL> select trunc(to_number( to_char(sysdate, 'SSSSS'))/7200) from dual
  2  /
TRUNC(TO_NUMBER(TO_CHAR(SYSDATE,'SSSSS'))/7200)
                                              6...and to get fifteen minute chunks of a date...
SQL> select trunc(to_number( to_char(sysdate, 'SSSSS'))/900) from dual
  2  /
TRUNC(TO_NUMBER(TO_CHAR(SYSDATE,'SSSSS'))/900)
                                            53
SQL> Cheers, APC
Message was edited by:
Numbers change to reflect the fact that one hour actually is 60*60 seconds.
APC

Similar Messages

  • Project Server 2013: Synchronization of AD with security groups - missing from list of timer jobs

    I have same problem in:
    http://social.msdn.microsoft.com/Forums/en-US/2b916bb9-2277-4c53-8b97-271a912414ba/ps2013-timer-job-missing-quotproject-server-synchronization-of-ad-with-security-groups-forquot
    "I cannot find timer job in SPS central administration "Project Server: Synchronization of AD with security groups for <PWAIntanceName>" to schedule synchronization. Enterprise Resource Pool synchronization working fine and timer job
    "Project Web App: Synchronization of AD with the Enterprise Resource Pool job for <PWA site name>" exist on server."
    Don't offer solution for "Schedule Enterprise Resource Pool synchronization".
    Only "Timer job in SPS central administration "Project Server: Synchronization of AD with security groups".
    Have a solution?

    Project Server timer job "Synchronization of AD with security groups" don't exist.
    So I created job in Task Scheduler of Project Server OS, that every day start PowerShell-script:
    if ((Get-PSSnapin | where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell
    Invoke-SPProjectActiveDirectoryGroupSync –Url http://project/pwa
    Security groups of Project Server automatically synchronize with groups from AD!
    http://technet.microsoft.com/en-us/library/jj219472.aspx

  • I can't enter the group (chain) of emails from time to time using iPhone OS MailBox software.

    I can't enter the group (chain) of emails from time to time using iPhone OS MailBox software. It's ok with stand-alone emails but email chains are existing unlogically. I just press on the chain (with double ">>" sign) and nothing is done. Also I can't enter one of my email account, but I think this issue can be corresponded with the previous one. your help is appreciated!

    Carolyn,
    I think your TV might be a rear projection model, correct? Those types of TVs inherently have overscan built into them as part of their optical design. The TV should have some picture SIZE settings that affect how much overscan is present, and some settings may even get rid of it altogether with the result there might be a small black border instead.
    Don't worry about changing TV settings. Settings like this are tied to a specific input. So if you make these types of changes while the TV is passing the mini's video through to the screen, those changes will only apply to the mini. When you switch to other inputs, like a cable box, etc., the old settings should still be intact and unchanged.

  • Editing objects in a group or several at a time

    hi
    is there any way of changing the fill colour of a shape if it is grouped with other shapes?
    is there any way of changing the fill colour of several shapes at the same time without using the default attributes route ( I need to have 2 colours in mhy doc so am using default attributes for one of them already).
    best tommy banana

    tommybanana wrote:
    is there any way of changing the fill colour of a shape if it is grouped with other shapes?
    When shapes are grouped, the background menu is disabled.
    is there any way of changing the fill colour of several shapes at the same time without using the default attributes route ( I need to have 2 colours in mhy doc so am using default attributes for one of them already).
    Select the shapes whose color must be changed (the command key is your friend to do that) then define the color from the background menu.
    If there is already one shape with the wanted color, select it, click the "Copy Style" button (install it if it is not).
    Select every shape which must receive this color.
    Click the "Paste Style" button (install it if it is not).
    Of course, all of that is described in the Numbers User Guide available from the Help menu
    Yvan KOENIG (from FRANCE mardi 17 mars 2009 14:33:38)

  • Group by specific periods of time - group by 5 seconds

    I would like to group records for every 5 seconds
    The following query groups for every second
    select to_char(state_transition_dt, 'MM/DD HH24:MI:SS'),
    UPPER(item_type) Type, UPPER(sync_operation) operation, count(*)
    from sync_traffic_flow h
    group by to_char(state_transition_dt, 'MM/DD HH24:MI:SS'), UPPER(item_type), UPPER(sync_operation)
    order by 1
    is there any way to group it for every 5 seconds??
    I tried following options:
    on executing the following query in timesten database I am getting error
    SELECT to_char(sysdate + (10/24/60), 'HH:MI AM') FROM dual;
    Error:
    Inconsistent dataypes:(DATE,NUMBER) are not compatible in expression (SYSDATE _ 10/24/60) - file "ptDataType.c" ...
    Also I am unable to use TRUNC function of oracle database.
    Is there any way to group records by specific intervals of time??

    Hi,
    I am looking for a query where I can get rows grouped by every 5 sec
    The following query fetches data for ever second but is there any way to fetch rows grouped by 5 sec
    select
         to_char(state_transition_dt, 'MM/DD HH24:MI:SS'),
         UPPER(item_type) Type,
         UPPER(sync_operation) operation,
         count(*)
    from
         sync_traffic_flow h
    group by
         to_char(state_transition_dt, 'MM/DD HH24:MI:SS'),
         UPPER(item_type),
         UPPER(sync_operation)
    order by 1
    I tried another query;
    instead of grouping records for 5 seconds this query is adding 5 seconds to each record and giving me same information back
    any other ways to group rows for every 5 seconds?
    select
    to_char(state_transition_dt+ numtodsinterval(5, 'SECOND'), 'MM/DD HH24:MI:SS'),
    UPPER(item_type) Type,
    UPPER(sync_operation) operation,
    count(*)
    from
    sync_traffic_flow h
    group by
    to_char(state_transition_dt+ numtodsinterval(5, 'SECOND'), 'MM/DD HH24:MI:SS'),
    UPPER(item_type),
    UPPER(sync_operation)
    order by 1
    Edited by: user13280764 on 01-Sep-2010 06:53

  • Update Ledger group in BKPF at the time of MIGO and MIRO

    Hi Friends,
    In our current implementation we have requirement to update a certain Ledger group, to restrict the postings in all ledgers, at the time of positng in MIGO and MIRO.
    Can you please let me know how we do this.
    Waiting for your reply,
    Madan Mohan

    Hi Santhosh,
    Thanks for your reply. But in the substitutions at header and line item level i didnt find the 'U300' userexit.
    Can you suggest me at what level i can find that user exit.
    Thanks and Regards,
    Madan

  • 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.

  • Need to Know How to Group Report in 30-Second Time Intervals

    I am trying to group records in the report based on a date/time field in a table.  The user enters a date/time range to report on, and I want the the records from the table that fall within the date/time range entered to be grouped in 30-second intervals on the report.  I've tried a number of different things and can't seem to get anything to work.  Can anyone provide some insight into how this can be done?  Thank you in advance!!

    Hi Joy,
    Sorry for the late reply.
    What you want to do is create a formula something like this (Syntax hasn't been verified... at all)
    whilereadingrecords;
    //I'm assuming your datetime field is a string. It probably isn't but you can do the same op with another
    //data type. I've also assumed (likely wrongfully) that the time in seconds is the last two digits
    //for sake of argument, your date time field has this format: YYYYMMDD-HH:MM:SS
    stringvar strSecondsOfCall;
    stringvar strYourGroupString; //or something
    strSecondsOfCall := right(<yourfield>, 2);
    if(strSecondsOfCall > "30") then strYourGroupString := left( (<yourfield>,15) & "30"
    else strYourGroupString := left( (<yourfield>,15) & "00"
    So, what the formula does is determine if the seconds portion of the date time occured in the former or the ladder half of the minue, and assigns it the floor value (arbitrary implementation on my part, you can call it whatever you like).
    Now, in your report, use the group exppert to group based on this formula field, and you should get the data the come out grouped in 30 second intervals.
    ie: You'll have groups like:
    20081231-12:59:00
       -all of the calls that happened from 59:00 - 59:30
    20081231-12:59:30
       -all of the calls that happened from 59:30 - 00:00
    Happy new year!!!

  • A group writing at the same time on one project

    Hello!
    First: Adobe Story is a wonderful and helpful programme! We've just discovered it and we are using it for our movie project.
    Question: We were wondering if it's possible that a group is working on a project at the same time.
    If someone is working on the project now, other co-authors are not able to change anything. Only if the person finishes his/her work, others can start changing things on the script. Is there a way of working parallel?
    Thanks in advance!

    Hi
    Great to hear that you are liking our software.
    As for your query, yes, Story does have a sharing feature. All you have to do is share the script with all your co-author/s who can then access the script in their Story account. While editing the script the co-author/author is the only person making changes and has the script 'locked' for the entire duration while he/she is editing it. Other co-authors can access the script in read mode at this time but cannot make any changes. They would be prompted if they attempt to do so.
    In order to share a script open it and then go to File->Share to share it. Type in the Adobe ID (email address) of all those with whom you want to share this script and define their role (Co-Author/Reviewer/Reader) there. Once shared the other users can login to their accounts and accept the document sharing (from Notification) and then work on the script.
    Hope this information is useful. Do keep us posted with your experience with Story.
    Thanks
    Ali
    Adobe Story Team

  • Windows Server 2012 Essentials - Implement Group Policy for the 1st time

    This is my first server. We have 15 users and 20 devices, all clients are running Win7 Pro.
    On the Dashboard, Devices tab, when I click on each device there is an option to implement Group Policy in the right-hand task pane. Does this mean I can implement it for one device at a time? Or will it happen for everyone in the domain?
    I'm hesitant to start. Is this something where I should wait for the weekend, so I can restore from a backup if need be?
    Thanks for your help
    Alan

    Time to get a basic Windows networking reference book and read up on group policy. Policies are applied by the system on a predicable refresh rate, which if memory servers is 15 minutes. This can be forced from the stations with the cli command "gpupdate
    /force" but in most cases there is little need to do so.
    Some, like folder redirection, only impact the stations on reboot/sign on
    Larry Struckmeyer[MVP] If your question is answered please mark the response as the answer so that others can benefit.

  • Group Policy Preferences - Registry change - time targetting

    I have a customer who wants to change the timeouts etc on a screensaver based on the time of day.
    Users often leave a machine open and on(with Bloomberg info) and work using another machine while they keep an eye on the Bloomberg one.
    The plan is to have these machines running Bloomberg have a long screen timeout during the working day, and then go back to the default screensaver timeout after that so the users don't have to continually enter a password.
    Looking at GPP it needs to be done via a registry change.
    I've created the policy  (screensaver, lock and screensaver on are all set (3 reg updates), then 2 time targeted additional reg updates for the screen saver timeout), but the policy only applies at logon or a forced gpupdate.  It doesn't update when
    the time change occurs.
    If I run a "gpupdate /force" the policy does change based on time.  I have tried a scheduled task for "gpupdate / force" and that didn't apply the change.
    Is GPP registry just not up to the job for time scheduling with a registry change, or am I doing something wrong?
    All machines are Win7 pro x64

    Hi JaseFromLodon,
    To make it work ,we can set this policy to have a check.By default, computer Group Policy is updated in the background every 90 minutes.We can change this time to "0" instead of creating a task schedule and the update will be performed every 7
    second.
    Computer Configuration\Administrative Templates\System\Group Policy \Set group policy refresh internal for computers
    Here is a link for reference
    Group Policy refresh interval for computers
    https://technet.microsoft.com/en-us/library/cc940895.aspx
    For the time range faeture ,I am sorry I didn`t explain the issue clearly .
    Pay attention to the "note " in step 13 of the link as you posted .
    "Make sure you allow for the policy refresh interval (default 90 minutes with a 20% random offset) when configuring the start and end time. This means you might want to start applying the policy 2 hours before the start of business (e.g. 6:30am) to make
    sure all the computers are configured with the Business Hours Power Plan before people login in the morning (e.g. 8:30am)."
    The time targeting feature doesn`t mean the preference settings will be applied according to the specific time we have set .It means the preference settings will be applied to the machines whose time is included in the time range .Please pay attention to
    the explanation of the time range features carefully (the screenshot I have posted).
    Manually "gpupdate /force "will work .I suspect the task schedule hasn`t been set correctly .Please check the running history of this task schedule.
    Best regards

  • 600 ex-rt Groups firing at a different time- Please help

    Hello everyone,
       First time on the forum and I really appreciate the assistance. I own 5 600 ex-rt's and I have them divided as follows:
    Master, 2 speedlites into Group A, 2 speedlites into Group B.
    I have them all on ETTL and have double-checked to ensure all of my settings are correct. The problem I am having is when I test fire them Group A fires and then Group B fires approximately a half-second later. 
    Is this normal? I have read the manual closely to verify they are on the correct settings for simultaneous firing, but I am obviously missing something.
    Thank you, Bill 

    Keif, how are you testing this? By pressing the test button by any chance? If so, it's designed to fire each group in delay of 1 second.

  • SQL question- on how to handle groups of records at a time.

    Hi,
    I have a sql that looks like the following:
    insert into INVALID_DATES_TMP
    (id, gid, created, t_rowid, updated)
    select id, gid, created, rowid, updated
    from TABLE1
    where fix_invalid_date_pkg.is_date_invalid('TABLE1', 'CREATED', ROWID) = 'Y';
    COMMIT;
    What the above sql does is selects all rows from TABLE1 where the CREATED column
    has invalid dates and inserts them into invalid_dates_tmp table. So we can process/fix
    those invalid dates from the temp table. Problem is our DBA said Table1 can have
    millions of rows so the above sql can be very database intensive. So, I need to
    figure out another way that may handle chunks of rows at a time from table1.
    Any ideas are appreciated!
    ThankYou,
    Radhika.

    Hallo,
    in general INSERT AS SELECT is the fastest method to insert into the table.
    Probably you can use direct load ? (Hint APPEND).
    Other options (INSERT IN LOOP or BULK + FORALL) are slower.
    I think, this method is optimal.
    Another question is, the function itself. It is not clear, whether it searches the invalid dates optimal. I suppose strong, that function uses dynamic SQL.
    Why ? It is better to search static . Or you use this function for many other columns ? Could you post the function also ?
    Regards
    Dmytro

  • Creation of Record Group and LOV at run time

    Hello All,
    I have been stuck by this...I have two text items on which LOVs have been placed.Selection of one depends on selection of other.I can dynamically create a record group but how to create a LOV dynamically to populate it with the dynamic record group been created.
    For more visualization consider that filtering of data takes place in one lOV based on the other LOV been provided.
    Revert ASAP...
    Thanks and Regards,
    Kapil Uppal

    I don't think you can create a LOV dynamically, but you can repopulate a pre-existing one, which should allow you to achieve the same goal.

  • Make layers in group visible by clicking 1 time

    How can I make all the layers in a group visible by a shortkey or one click. (instead of clicking on each single eye-icon of the layers)
    (I have problems with layercomps and when I switch to another layer comp the groups become visible but not the content of the group. Is this a bug?)
    Thanks!

    How can I make all the layers in a group visible by a shortkey or one click. (instead of clicking on each single eye-icon of the layers)
    (I have problems with layercomps and when I switch to another layer comp the groups become visible but not the content of the group. Is this a bug?)
    Thanks!

Maybe you are looking for

  • BT transcieving Key & W2003 / MSI support sucks!

    What kind of a f*cked up company is this, no support, no replies, on website it's IMPOSSIBLE to find anything but motherboards in other owrds, they don't give a damn about customers. I bought Bluetooh Transceiving Key and driver won't work under Wind

  • Problem in dispalying the image !!!!

    Here i'm reading the contents of the file and displaying the image in the jsp as well as the contents of the file. For displaying the image i'm retrieving the image from the file. I've written the following code but it is showing the error, i'm not a

  • IPod won't turn on. How to solve this problem?

    Hi guys! I just want to ask some help regarding my iPod 3rd gen 64gb if it can still be fixed. I charged my iPod and set it to high brightness. After one hour I didn't know that it wasn't plugged properly. I tried charging it again using a fireware a

  • Creating a PDF from Word 2003: recommended settings for screenshot pictures without artifacts?

    My Word 2003 document shows screenshots from text dialogs (some 100% and some in reduced size). While the quality of the pictures is good in the MS Word viewer, my created PDFs show artifacts mainly at the black texts: the single characters are erode

  • Archive Log Format Issues

    Hi DBAs, I have 2 Archive destination. My archive log format is ARC%S_%R.%T But In my 1 location E:\app\Administrator\product\11.1.0\db_1\RDBMS format shows ARC00025_0769191639.001 2 location shows E:\app\Administrator\flash_recovery_area\BASKAR\ARCH