Results 1 to 2 of 2
  1. #1
    lonesoac0 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    36

    Trying to sum values based off of the many records in relationship

    Hello all,

    I am trying to figure out how to sum up unit values in a one to many relationship. Here is what my data looks like:

    Table1:
    (PriKey)BuyID FirstName LastName
    ------------------------------------------
    1 Andrrew Anderson
    2 Jake Bledso

    Table 2:
    BuyID FirstName LastName Units
    ------------------------------------------
    1 Andrew Anderson 2
    1 Andrew Anderson 1


    2 Jake Bledso 2
    2 Jake Bledso 3

    What I want my query to result in is:
    BuyID FirstName LastName Units
    ------------------------------------------
    1 Andrew Anderson 3
    2 Jake Bledso 5

    How can I perform this kind of query?

  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
    You want a totals query. Start a regular query selecting those fields. Click on the "E" on the ribbon that says totals query. Change Group By to Sum for the units field.

    By the way, the name should not be stored in table 2, just the ID from table 1.
    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. Replies: 11
    Last Post: 02-11-2015, 01:30 PM
  2. Replies: 6
    Last Post: 11-15-2014, 02:05 PM
  3. Replies: 12
    Last Post: 04-07-2012, 12:09 PM
  4. Replies: 8
    Last Post: 02-26-2012, 09:48 PM
  5. Select record based on values of other records
    By dchaboya in forum Queries
    Replies: 2
    Last Post: 08-11-2011, 10:41 AM

Tags for this Thread

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