Results 1 to 4 of 4
  1. #1
    jcharbula is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    5

    Need Help Counting Attendance

    I need an Access SQL query to count the number of times someone attended a class.....
    So I have a table that has 10 week fields, (ex:week1,week2,week3,etc)
    If a student attended during that week, there is a date in that field.
    For each student, I need to know how many weeks they attended a class. If they did not attend a class any particular week that field will be null(blank)


    So for example, Student ID 1 - if they attended 7 out of the 10 weeks, I would like to display the student ID and the count of weeks they attended
    Please help me devise this query?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You're using a non normalized structure, in other words each week is accounted for in a separate column. This is going to make your queries cumbersome and I'd suggest you look at normalizing your database (there are tons of articles on the web about normalization).

    For your purposes your formula would be something like:

    WeeksAttended: iif(isnull(week1), 0,1) + iif(isnull(week2), 0,1) + ... for each week column in your table.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Yes, put the date as the field:

    student, date,attend

  4. #4
    jcharbula is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    5
    Thank You!

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

Similar Threads

  1. Replies: 6
    Last Post: 01-16-2014, 12:41 PM
  2. Counting Attendance Checkboxes per ID
    By Rshukis in forum Queries
    Replies: 1
    Last Post: 04-05-2013, 01:50 PM
  3. Attendance Report
    By tabbycat1234 in forum Reports
    Replies: 1
    Last Post: 11-12-2011, 07:08 AM
  4. Database of attendance
    By antoniopom in forum Database Design
    Replies: 1
    Last Post: 01-19-2010, 06:49 AM
  5. Attendance design
    By 8rxtx8 in forum Database Design
    Replies: 0
    Last Post: 07-19-2009, 04: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