I need a query for getting the 2nd highest marks from a table.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table "Student" consists of two fields "Name" & "Marks". I want to
write a query for getting the 2nd highest marks obtain by student from the
table.
 
You could paste the following into the SQL view of the query window:

SELECT Max(Student.Marks) AS Expr1
FROM Student
WHERE (((Student.Marks) Not In (select Max(Student.Marks) from Student)));

To do it using the query grid, add the Student table,
Enter "Expr1: Max(Student.Marks)" (but no quotes) into the Field row of the
first column
Enter "Marks" into the Field row and "Student" into the table row, and "Not
In (select max(Student.Marks) from Student)" into the Criteria row of the
second column (no quotes around these, either)

Run the query
 
Back
Top