Unix Technical Forum

date, select // count per 10 minutes

This is a discussion on date, select // count per 10 minutes within the Oracle Miscellaneous forums, part of the Oracle Database category; --> for statistics i need to select the number of orders per 10 minutes. So i want to do something ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-05-2008, 12:00 PM
Gerhard
 
Posts: n/a
Default date, select // count per 10 minutes

for statistics i need to select the number of orders per 10 minutes.

So i want to do something like
SELECT TRUNC(insert_date, '??'), COUNT(*)
FROM orders .... ;

But within the trunc-(or other data-based) function allowed Patterns
are "HH" or "MI".

as workaround i use:
SELECT TRUNC(insert_date,'HH') +
TRUNC(TO_CHAR(ord_close_dt,'MI'),-1)/(60*24), COUNT(*)
FROM orders .... ;


Is there an easyer way to do the select?

Thanks
Gerhard

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-05-2008, 12:00 PM
Michel Cadot
 
Posts: n/a
Default Re: date, select // count per 10 minutes


"Gerhard" <gerhard_ulrike@yahoo.de> a écrit dans le message de news:
21de0c2c-1e47-4853-b977-9a4181cf6566...oglegroups.com...
| for statistics i need to select the number of orders per 10 minutes.
|
| So i want to do something like
| SELECT TRUNC(insert_date, '??'), COUNT(*)
| FROM orders .... ;
|
| But within the trunc-(or other data-based) function allowed Patterns
| are "HH" or "MI".
|
| as workaround i use:
| SELECT TRUNC(insert_date,'HH') +
| TRUNC(TO_CHAR(ord_close_dt,'MI'),-1)/(60*24), COUNT(*)
| FROM orders .... ;
|
|
| Is there an easyer way to do the select?
|
| Thanks
| Gerhard
|

SQL> with
2 data as (
3 select trunc(sysdate)+dbms_random.value(0,86400)/86400 h
4 from dual
5 connect by level <= 10
6 )
7 select to_char(h,'DD/MM/YYYY HH24:MI:SS') h,
8 to_char(trunc(h)+trunc(to_char(h,'SSSSS')/600)/144,
9 'DD/MM/YYYY HH24:MI:SS') "10m"
10 from data
11 order by h
12 /
H 10m
------------------- -------------------
03/09/2008 02:41:01 03/09/2008 02:40:00
03/09/2008 04:01:07 03/09/2008 04:00:00
03/09/2008 04:25:44 03/09/2008 04:20:00
03/09/2008 08:20:07 03/09/2008 08:20:00
03/09/2008 10:02:51 03/09/2008 10:00:00
03/09/2008 15:57:34 03/09/2008 15:50:00
03/09/2008 16:56:32 03/09/2008 16:50:00
03/09/2008 18:02:26 03/09/2008 18:00:00
03/09/2008 18:32:48 03/09/2008 18:30:00
03/09/2008 23:30:14 03/09/2008 23:30:00

10 rows selected.

Regards
Michel


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: date, select // count per 10 minutes

Thread Thread Starter Forum Replies Last Post
subtracting minutes from date Brandon Metcalf Pgsql General 4 04-09-2008 09:30 AM
Re: subtracting minutes from date Chandra Sekhar Surapaneni Pgsql General 1 04-09-2008 09:30 AM
update a date field with fixed date but random hours/minutes Harry331 Oracle Miscellaneous 10 04-08-2008 09:55 AM
Return minutes as date datatype Paul Oracle Miscellaneous 9 04-07-2008 10:56 PM
How to sum minutes to date Max Oracle Miscellaneous 4 04-07-2008 07:50 PM


All times are GMT. The time now is 09:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com