lorrainemutheu
lorrainemutheu

Reputation: 115

Range in Query Design View Access

I have a 'student' table with details of id,name,sex,age,year,gpa of students. I have another table 'major' table with the ids of students and the course which the major in(dname).

student table and major table

I would like to find the difference in age between the oldest student and the youngest student majoring in 'Computer Sciences'. This has proved difficult for me since the total function does not include 'range'.

total_function

When I try to find the difference between the maximum and minimum age using 'expression' in the total function I get this error....."Your query does not include the specified expression 'age' as part of an aggregate function"

error_image

How should i go about this to find the difference between the maximum and minimum age?

Upvotes: 0

Views: 1792

Answers (2)

Santosh
Santosh

Reputation: 12353

Change Total: from Group By to Expression and define the criteria in Field: (see below).

enter image description here

Upvotes: 1

Wolfgang Kais
Wolfgang Kais

Reputation: 4100

Change the first field of the query as follows:

  • Remove the criteria
  • Replace the field name (age) with the formula Max([age])-Min([age])

Upvotes: 1

Related Questions