How do you average in a query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomric
    New Member
    • Nov 2009
    • 31

    How do you average in a query?

    I have a query that sorts data from a table based on a build type. Each build type has several designs, and each design has several bars associated with it. For each bar there is 42 to 64 different parts, and each part has data from 8 different electrical tests performed on it. How do you average the electrical test data so that my query comes out as a column for BAR#, DESIGN#, and a column for each electrical test that has the average for that test on that bar?
  • Paul Hanrishfeger
    New Member
    • Mar 2010
    • 7

    #2
    Average in Query

    In query design view right click in a field and select Totals. A new row will appear with group by in each column. Select the column you want to average then change the group by via the drop down to Average. Save and run the query.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32656

      #3
      The SQL for your query would be similar to :
      Code:
      SELECT   [BAR#],
               [DESIGN#],
               Avg([Test1]) AS Test1Avg,
               Avg([Test2]) AS Test2Avg,
               Avg([Testn]) AS TestnAvg
      
      FROM     [YourTable]
      
      GROUP BY [BAR#],
               [DESIGN#]
      This doesn't mean Paul's answer is wrong by the way, it is simply saying the same thing but from a different perspective.

      Comment

      Working...