Results 1 to 5 of 5
  1. #1
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11

    Creating a SQL query with three (3) "WHERE" clauses

    SELECT Sum(AppsChecked) AS TotAppsChecked, Sum(AppErrors) AS TotAppErrors, (TotAppErrors)/(TotAppsChecked)*100 AS PctErrors
    FROM Stats


    WHERE [OperatorId]=[Enter OperatorID] AND [Date]=[Enter Start Date] AND [Date]=[Enter End Date];

    The above is the code that I am trying to get to work that will give me the totals apps checked, total app errors with the percentage calculation by a specific user (OperatorId) and over a specific period of time. The operator id and the date range will be inputted by the person running the query. I have gotten the above code to work without the date range. Can someone help. OnLineTestBook.zip
    I have attached a zip file with what the data should be in the Access table.

  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,652
    The date can't be equal to 2 different dates. I suspect you want:

    WHERE [OperatorId]=[Enter OperatorID] AND [Date] Between [Enter Start Date] AND [Enter End Date];
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11
    Thank you so much! I knew it was something with the dates that I was missing, just couldn't see it!

  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,652
    Happy to help! If it's not too late, Date is not a good field name; sooner or later Access will confuse it with the Date() function.

    Reserved Words in Microsoft Access
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11
    It's not! And Thanks much!

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

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2015, 06:33 AM
  2. Creating an SQL query with AND and Or clauses.
    By Johanb26 in forum Queries
    Replies: 2
    Last Post: 07-08-2015, 05:30 AM
  3. Replies: 1
    Last Post: 02-05-2015, 05:41 PM
  4. Replies: 3
    Last Post: 12-06-2014, 03:59 AM
  5. Replies: 1
    Last Post: 07-26-2013, 11:42 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