I have a table with fields a, b, c, department, and year. Fields a,b, and c will be a number between 1 and 6, department will be x, y, or z, and year will be 2003, or 2004.
I need to find the average of all the records for fields a, b, and c where that record does not = 6 then group it by year and by department.
I.E. Averages would be....
a b c dept year
----------------------
1 6 3 x 2004
2 1 4 x 2004
6 3 2 y 2003
1 4 3 z 2005
The total average of a would be (1+2+1)/3, b would be (1+3+4)/3 and c would be (3+4+2+3)/4. Notice it only averages where the record does not = 6.
This is what I would like the output to look like.
(this example does not use the numbers from the example above)
a b c dept year
-----------------------
2.7 3.5 4.1 x 2003
1.8 2.1 3.9 x 2004
1.4 3.2 4.1 y 2003
4 3.1 3 y 2004
3.1 2.3 4.2 z 2003
1.4 3.2 3.2 z 2004
Can I do this in one query?
-Al
I need to find the average of all the records for fields a, b, and c where that record does not = 6 then group it by year and by department.
I.E. Averages would be....
a b c dept year
----------------------
1 6 3 x 2004
2 1 4 x 2004
6 3 2 y 2003
1 4 3 z 2005
The total average of a would be (1+2+1)/3, b would be (1+3+4)/3 and c would be (3+4+2+3)/4. Notice it only averages where the record does not = 6.
This is what I would like the output to look like.
(this example does not use the numbers from the example above)
a b c dept year
-----------------------
2.7 3.5 4.1 x 2003
1.8 2.1 3.9 x 2004
1.4 3.2 4.1 y 2003
4 3.1 3 y 2004
3.1 2.3 4.2 z 2003
1.4 3.2 3.2 z 2004
Can I do this in one query?
-Al