Results 1 to 4 of 4
  1. #1
    amyjh38 is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    2

    Help With Grouping By Hour


    I'm not sure if this would be better done in a query or report so I am going to start in the query forum. I have a table with 3 fields. TimeStamp, StationID, MeanWind. Ex: 7/1/2014 10:00 PM|WT01|1.2

    The MeanWind data is recorded every 10 minutes. So the entry below the above example will be 10:10 PM, etc. Unless there is no MeanWind recorded at 10:10. In that case the next entry would be whatever time there was a MeanWind. (I hope this makes sense)

    I need to group the data by each hour with an average wind speed. So I need data from 10:00 PM thru 10:50 PM, then from 11:00 PM to 11:50 PM, etc.

    To be honest, I'm kinda lost trying to figure this out. Any and all help will be truly appreciated!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Try using the DateValue() and Hour() functions in your query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    amyjh38 is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    2
    When I tried that the problem I had is it pulled records from 10:00 PM thru 11:00 PM, then 11:10 PM thru 12:10 PM, etc. I don't know how to specify the group period so it will go from 10:00 PM thru 10:50 PM, 11:00 PM thru 11:50 PM, etc.

    I'm not exactly an Access whiz so I'm sure the problem is me!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    The Hour() function shouldn't have done that. Try this query (I'm assuming you also want to group on StationID):

    SELECT DateValue(TimeStamp) AS ReadingDate, Hour(TimeStamp) AS ReadingHour, StationID, Avg(MeanWind) AS WindAvg
    FROM TableName
    GROUP BY
    DateValue(TimeStamp), Hour(TimeStamp), StationID
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2014, 09:25 AM
  2. Replies: 1
    Last Post: 10-20-2013, 10:04 AM
  3. Trying to find hour that has most attempts
    By pdpeterson87 in forum Queries
    Replies: 5
    Last Post: 10-08-2013, 03:52 PM
  4. Rounding number up to half hour
    By crxftw in forum Forms
    Replies: 2
    Last Post: 08-23-2011, 07:29 AM
  5. Time minus one for hour.
    By brianb in forum Queries
    Replies: 2
    Last Post: 03-09-2011, 11:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums