Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    2

    Question Unanswered: Getting the Highest Average

    Hi,
    I need to get the module_code with the highest Average. My code so far is :

    SELECT Module_code
    FROM Module
    NATURAL JOIN Script
    GROUP BY Module_code
    HAVING AVG(Mark) = MAX(SELECT AVG(Mark)
    FROM Script
    GROUP BY Assessment_number));

    Unfortunatly this gives me an:

    ORA-00936: missing expression

    Error. Any ideas on what could be wrong/better way of doing it.

    Cheers

    Olly

  2. #2
    Join Date
    May 2004
    Posts
    2
    SELECT Module_code
    FROM Module
    NATURAL JOIN Script
    GROUP BY Module_code
    HAVING AVG(Mark) >= ALL (SELECT AVG(Mark)
    FROM Script
    GROUP BY Assessment_number);

    This seems to be working, not 100% sure though

    Olly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •