title: SQL,Nested Queries (MS ACCESS)
body: <p>I am trying to tackle a problem but seem to be getting nowhere. I want to display Grade 12 students who scored below average for Maths then instead of displaying their average display their maths marks instead.</p>
  
  <p>I am using msAccess and suspect the use of nested queries are necessary.The fields I am working with are first_name, last_name, grade (from 1 to 12) and Maths (containing maths marks)</p>
  
  <p>I have this: </p>
  
  <pre><code>Select first_name,last_name,maths
  FROM students
  WHERE grade = 12
  HAVING ROUND(AVG(maths),1)&lt; maths;
  </code></pre>
  
  <p>Output:</p>
  
  <p>Error:
  You tried to execute a query that does not include the specified expression 'first_name' as part of an aggregate function </p>
  
  <p>However, I do not know why it is throwing this error and it repeats like this even after removing the field from select which I don't want to do in the first place because I need to display it</p>