Results 1 to 3 of 3
  1. #1
    jpunja is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    3

    Add [count] and [average] to existing table

    Although I know this is not how database-tables should be used, I would like to add two columns average and count to my existing table. The original table:



    Name Age City
    John 10 NY
    John 80 London
    John 30 NY
    Bill 10 NY
    Bill 40 NY
    Bill 25 NY

    I would like to add two columns:
    average of age group by name and CITY = NY
    Count: group by name and CITY = NY

    So you get:

    Name Age City count average
    John 10 NY 2 20
    John 80 London - -
    John 30 NY 2 20
    Bill 10 NY 3 25
    Bill 40 NY 3 25
    Bill 25 NY 3 25


    I can make a table with average and count, and join this table in a second query. But I can't get it into one query. Hopefully you have the solution!

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    build a 'report' table like yours.
    empty the table
    run an append query to add the names, count
    then run another append query to post the avg.
    then run a select query to sum all the columns for your results.

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

Similar Threads

  1. Replies: 29
    Last Post: 04-25-2014, 03:49 PM
  2. Replies: 3
    Last Post: 04-06-2013, 10:04 AM
  3. Replies: 9
    Last Post: 03-16-2012, 11:13 AM
  4. Count Unique Fields and then get Average
    By Kirsti in forum Queries
    Replies: 5
    Last Post: 02-19-2012, 07:25 PM
  5. Replies: 1
    Last Post: 05-25-2010, 02:58 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