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: Averaging Query on Logging Table

Re: Averaging Query on Logging Table

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 23 Sep 2001 14:30:45 -0700
Message-ID: <9olka50c09@drn.newsguy.com>


In article <Cjcr7.4$6f3.10675_at_news0.optus.net.au>, "Matt says...
>
>Hi All,
>a quick question. I have a logging table ACCESS_LOG with a DATE_LOGGED and a
>USERNAME field that contains one row for each logged action per user. I want
>to find out an average of how many actions are performed by each user each
>day. That is I would like to be able to state that on average X actions are
>performed by each user on a given day.
>
>Has anyone got any tips on how to get started? I am using Oracle 8.1.6.
>
>Matt.
>
>

select username, avg(cnt)
  from (select username, count(*) cnt

          from t
         group by username, trunc(date_logged)
       )

 group by username
/
--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sun Sep 23 2001 - 16:30:45 CDT

Original text of this message

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