Results 1 to 6 of 6
  1. #1
    rlsublime is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    58

    Query to group fields and sum

    if I have the following amount other names in a table and I am trying to group them and sum them up. Curently i have figured out how to strip out the 3 names from the table but what i am trying to really do is group them as a BofA field with the sums of the 3.. how could i accomplish this?Thanks
    Name 2010 2011 2012


    BofA 1 22 44
    Country Wide 55 66 88
    Merrill Lynch 23 12 42

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Don't understand what you mean by 'group them as a BofA'.

    Build a report to show detail records and summary totals of those records. Calculation in textbox of group or report footer can total each of the 3 columns.
    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
    rlsublime is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    58
    I would like all totals to fall in a category called Bank of America. Is there a way to not do this through a report but to just add the sums in the fields. the reson is because there will be further analysis, ranking, pivots etc done in excel. so all the data will be exported and analyzed in excel. is there a way to sum the 3 records using a query.Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Are there other Names in this field? If not, just sum all the records. If there are other names, can include filter to retrieve only those that have any of the 3 names.

    Does this get what you want:

    SELECT "BofA" As [GroupName], Sum(2010) As Sum2010, Sum(2011) As Sum2011, Sum(2012) As Sum2012 FROM tablename GROUP BY "BofA" WHERE [Name]="BofA" Or [Name]="Country Wide" Or [Name]="Merrill Lynch";
    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.

  5. #5
    rlsublime is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    58
    Thanks. This looks like it could work. But I had two questions. 1) Where do i insert this statement and 2)Do I have to define a new field called group name. Currently I have the following fields: Name: 2010: 2011: 2012. Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Copy/paste that statement into the SQL View of query designer. Adjust it to use your table and field names. The query is constructing the GroupName field. It exists only within the query. Then switch to query Design View and can see the structure in the grid.
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-21-2012, 07:40 PM
  2. Combine 2 queries,and Group Fields
    By SunnyInCO in forum Queries
    Replies: 5
    Last Post: 04-12-2012, 04:21 PM
  3. Replies: 6
    Last Post: 09-27-2011, 04:39 PM
  4. query group by over another group by?
    By gap in forum Queries
    Replies: 2
    Last Post: 07-04-2011, 12:59 AM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 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