Results 1 to 3 of 3
  1. #1
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55

    Query Time Grouping

    Hello All,

    I would like to query my records using the time field by grouping in 2 min intervals. So if a record falls within a 2 min time frame show me the minimum time. (version 2016).

    date time buttons
    9/30/2018 6:12:31 1
    9/30/2018 6:12:35 2
    9/30/2018 6:12:40 3
    9/30/2018 6:16:12 1
    9/30/2018 6:18:08 1
    9/30/2018 6:24:50 4
    9/30/2018 6:24:52 3
    9/30/2018 6:26:46 1

    For example the first 3 records above would be grouped together and the min time would show as 6:12:31.

    The last 3 bottom records would be grouped together and the min time would be 6:24:50

    Any ideas?

    Thanks to all who respond.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    A 2-minute timeframe in relation to what? Where should the calculation for grouping begin and end?

    Categorizing each record depends on value in another record. This is not simple. Will likely require VBA and not a challenge I would want to tackle.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by June7 View Post
    A 2-minute timeframe in relation to what? Where should the calculation for grouping begin and end?
    231 is not a group because the span is more than 2 minutes (3:37)
    311 is not a group because span is 5:28
    ...and so on.
    This makes it harder than what I originally thought (as in maybe a subquery) but I kind of doubt it is doable without code, as you say. It would require an inner and outer loop on a rs to say the least. Possibly made more difficult as there's no unique ID, so the chosen record has to be based on the original time value from a varying sized set of comparisons.

    EDIT: Although not revealed, I presume the group size has to be 3, otherwise 11 is a group (56 seconds).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Grouping by date/time intervals
    By Sampaio in forum Queries
    Replies: 6
    Last Post: 01-30-2019, 04:12 AM
  2. query with max date and grouping
    By tricman10 in forum Queries
    Replies: 2
    Last Post: 03-09-2018, 09:06 AM
  3. Average time and grouping
    By sdel_nevo in forum Queries
    Replies: 4
    Last Post: 07-22-2014, 06:28 AM
  4. Query Grouping Help
    By athyeh in forum Queries
    Replies: 1
    Last Post: 04-15-2014, 09:38 AM
  5. Grouping query
    By Mphiri in forum Programming
    Replies: 10
    Last Post: 06-15-2010, 08:58 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