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

    Help with query!?


    Hey guys. I have a database with thousands of records in one table. There are two fields: data and value. Date is a long date formatted as dd/mm/yyyy hh:mm:ss(this was imported from excel). I am trying to write a query that will tell me, for each day, how long was the value field consecutively outside of a certain range. Example: We have 1000 data points for 5-5-11. The value field spans from 1 to 10. I need to figure out what was the most consecutive readings outside the range of 3 - 8. And then do so for every day we have data for.

    Any help or direction will be greatly appreciated! Thanks in advance!!

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Till some one comes along, just check if below gives some guidelines :

    Code:
    SELECT 
        myTable.TheDate, 
        Count(myTable.TheValue) AS CountOfTheValue
    FROM 
        myTable
    WHERE 
        (
            (
                (myTable.TheValue)<3
            )
        ) 
        OR 
        (
            (
                (myTable.TheValue)>8
            )
        )
    GROUP BY 
        myTable.TheDate;
    Have assumed, the time factor in the date is 0. If no, try with DateValue().

    Thanks

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

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