Results 1 to 3 of 3
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    sum and max in the same query

    All, using access 2010. I am trying to keep from creating multiple queries for one solution. Have two table joined by custid. query: custid and state from one tbl and grossreceipts and costid from the other table. group by custid, state and costid and sum gross receipts. Then I need to get the max of sum gross receipts, group by custid, state and costid and add the results to another table. Do you see a way to get this down to possibly one query?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Could possibly nest the queries but no, don't think one SELECT will suffice.

    Are you trying to save aggregate data to table? Why?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    No. Append custid, state and costid; not receipt. Using max receipts or refererce for other data. Im open to nesting if it eliminates multiple tables. I tried using another select to get the max but not having luck. I will keep trying because it's confusing to the user

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

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