Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: query: "count" each minute between start/end

Re: query: "count" each minute between start/end

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 27 Jul 2007 15:06:38 -0700
Message-ID: <1185573996.851804@bubbleator.drizzle.com>


Nikolas Tautenhahn wrote:
> Hi there...
>
> I have a table with access statistics with columns representing the
> [date] when a user first connected and the duration[seconds] they stayed.
>
> For a graphical report I need to create a view which shows how many
> users were online each minute of the day, i.e. say we have this raw data:
>
> user1: entered today, 9:30:17, stayed for 200 seconds (so he needs to be
> counted for 9:31, 9:32, 9:33 as he left 9:30:37).
> user2: entered today, 9:28:10, stayed for 180 seconds (so he needs to be
> counted for 9:29, 9:30, 9:31) and what I would like to get from this raw
> data is something like:
>
> 9:29, 1
> 9:30, 1
> 9:31, 2
> 9:32, 1
> 9:33, 1
> Let's name the connect date when a user entered "c_date" and the
> duration simply "duration"
> how could I do something? I can calculate the [date] when a user left by
> c_date + (1/86400)*duration and I guess I would need something like
> between, but I can't put my finger on how I could increment the counter
> for all whole minutes between c_date and the end-date...
>
> thanks for all help,
> N.

One way would be to outer join to a pipelined table function.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Jul 27 2007 - 17:06:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US