By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Having MAX() Query Question

P: n/a
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=CLASSES.Id and CLASSES.Section=12345 group by CLASSES.Id
having MAX(CLASSES.Term)=1000 order by PEOPLE.Name;

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

When I remove the "Section=12345" 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

Aug 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.