Having MAX() Query Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nino9stars@yahoo.com

    #1

    Having MAX() Query Question

    Hello,

    I have a table (PEOPLE) with the following information (Id, Name)

    I have another table (CLASSES) with the following information (Id,
    Course, Section, Term)

    I want to get all the people's names that have are in section 12345 and
    that are graduating in term 1000.

    So, this is what I came up with:

    select PEOPLE.Id, PEOPLE.Name from PEOPLE, CLASSES where
    PEOPLE.Id=CLASS ES.Id and CLASSES.Section =12345 group by CLASSES.Id
    having MAX(CLASSES.Ter m)=1000 order by PEOPLE.Name;

    Unfortunately, this returns an empty set, and I have no idea why?

    When I remove the "Section=12 345" then I get the result of all the
    people that are graduating in 1000.
    If I remove the "having MAX(Term)=1000" then I get all the people in
    section 1000.

    Is there a way to have both?

    Thanks,
    Nino Skilj

Working...