Results 1 to 5 of 5
  1. #1
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38

    Grouping and Addiing using Query Builder

    This question is for access 2010 :



    I have TableA

    Car Car Type Limited Test Miles Miles Driven
    Toyota Camry 1000 400
    Toyota Corolla 1000 10
    Toyota Prius 1000 6000
    Ford F150 600 100
    Ford F250 600 50
    Chevy Malibu 100 50


    I want a query to populate this

    Car Limited Test Miles Miles Driven
    Toyota 1000 6410
    Ford 600 150
    Chevy 100 50

    In words.. I would like to get a total of test miles driven in each car brand (i.e Toyota, Ford, Chevy). For instance, Toyotas will add up all test miles for Camry, Corolla, and Prius as Ford will add up all test miles driven for the F150 and F250.

    Will anyone know how to do this by using query builder? I want to setup through SQL.
    Been working on this for 2 days, and I am getting the wrong sum totals.

    I have grouped by Car and summed up miles driven in my query builder.

    I thought this was easy... but its proving to be a hassle

  2. #2
    GAccess is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    38
    Anybody?

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  4. #4
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    GAccess - In your query, you could try...
    Car, Group By
    LimitedTestMiles, MAX
    MilesDriven, SUM

    the SQL would look something like...

    SELECT DISTINCTROW tblCar.Car, Max(tblCar.LimitedTestMiles) AS [Max Of LimitedTestMiles], Sum(tblCar.MilesDriven) AS [Sum Of MilesDriven]
    FROM tblCar
    GROUP BY tblCar.Car;

    Change name(s) of table and fields accordingly.

    Hope this helps,

    Jim

  5. #5
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    Sorry Orange, didn't see your reply before posting. Jim

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

Similar Threads

  1. expression builder: update query
    By JMac in forum Access
    Replies: 3
    Last Post: 05-04-2012, 03:19 AM
  2. Run Query in Macro Builder
    By chewbears in forum Queries
    Replies: 0
    Last Post: 11-21-2011, 09:18 AM
  3. Need to create a UI dynamic query builder
    By dollylectric in forum Programming
    Replies: 1
    Last Post: 11-16-2011, 02:09 PM
  4. Linked Tables verus Query Builder
    By accessmatt in forum Access
    Replies: 5
    Last Post: 09-06-2011, 04:36 PM
  5. sql query builder and tables
    By benjammin in forum Queries
    Replies: 1
    Last Post: 05-28-2011, 02:11 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