View Full Version : Average


kburch1
11-29-2001, 11:58 AM
I am trying to code for my query to supply the average of the parameters displayed? Could someone please help.

raskew
11-29-2001, 02:34 PM
Please clarify 'average of the parameters'.

Pat Hartman
11-29-2001, 03:06 PM
I'm going to assume that you mean by "parameters displayed" that your query includes some selection criteria.

You'll need two additional queries. One with IDENTICAL selection criteria to your original query. The first query will count the members of the domain and the second will join the original query to the "totals" query to compute the average for each row. In this query simply select the original query plus query1 (as described below) without drawing a join line. There are no common fields so Access will prroduce a cartesian product. ie. it will match each row of the original query with the single row produced by query1. You can then add the calculation to produce the average.

query1:
Select Count(*) As TotalMembers
From YourTable
Where -selection criteria identical to your original query-;

If you are not trying to average across the entire domain but within certain groups such as department, you qill need to include department in query1 and add a group by clause. Then in the final query, you will have to draw a join line connecting the department columns from each query.