Results 1 to 8 of 8
  1. #1
    GeirA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    10

    Counting

    I have this database:





    And would like to count how many persons has authorization to each machine.

    I'm trying to get something like:

    MachineID Authorized
    11 2
    12 4

    I have tried several combination of count and distinct - but has so far only been able to get the total number of authorized on all machines

  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,642
    Try

    SELECT MachineID, Count(*) AS HowMany
    FROM DSO
    WHERE Authorized = True
    GROUP BY MachineID
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GeirA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    10
    Thanks! That helped me a lot..

  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,642
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    GeirA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    10
    I have run into another "problem".

    Is it possible to display MachineName (from another table) instead of MachineID?

    Click image for larger version. 

Name:	machinename.png 
Views:	9 
Size:	62.2 KB 
ID:	6510

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You should be able to join the two tables together in your query and then group on the name instead of the ID.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    GeirA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    10
    Thank you for guiding me in the right direction!

    With this I got what I wanted:

    Click image for larger version. 

Name:	sqlsyntax.PNG 
Views:	5 
Size:	7.2 KB 
ID:	6541

    Click image for larger version. 

Name:	sql.PNG 
Views:	4 
Size:	4.5 KB 
ID:	6542

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Happy to help!
    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. Counting Help
    By Jessyx in forum Access
    Replies: 1
    Last Post: 12-03-2011, 01:34 AM
  2. Counting Data
    By kwooten in forum Queries
    Replies: 5
    Last Post: 08-31-2011, 06:19 AM
  3. Counting Entries
    By adams.bria in forum Queries
    Replies: 6
    Last Post: 08-26-2011, 10:41 AM
  4. Counting
    By rfs in forum Forms
    Replies: 0
    Last Post: 03-15-2011, 03:20 PM
  5. Counting rows
    By anishap in forum Access
    Replies: 0
    Last Post: 10-08-2008, 10:41 PM

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