Getting Total average

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • indosmoke
    New Member
    • Feb 2010
    • 1

    Getting Total average

    Hey all,

    I'm trying to get a total average of the daily average. Below is my query for getting the daily average:

    SELECT DailyAverage=AV G(T.Photo_Readi ng)
    ,date=s.H_date
    FROM T inner join
    s on T.CID = s.EID
    where T.CID like '3RBK%'

    Group by sL3CoilLog.H_da te
    Order by sL3CoilLog.H_da te desc.

    Here is my output:

    Daily AVG Date
    76.580000 02182010
    76.823076 02172010
    88.040000 02162010
    81.918750 02152010
    82.436363 02142010
    76.300000 02132010
    79.622727 02122010
    76.300000 02112010
    78.866666 02092010
    75.728000 02082010
    73.320000 02072010

    The number that I'm looking for is 78.7214, which is the total average of the daily average. Any idea of how to query it?
  • OraMaster
    New Member
    • Aug 2009
    • 135

    #2
    Hi
    Please give a try to below SQL. It may help you.

    SELECT AVG (da.daily_avg)
    FROM (SELECT h_date, AVG (photo_reading) daily_avg
    FROM t
    GROUP BY h_date
    ORDER BY h_date) da
    Modify this SQL as per you need.

    Regards,
    Bhushan

    Comment

    Working...