473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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=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
0 7003

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Geo H | last post by:
I have a phpBB board with some of my users in a particular usergroup...using the following query: $usrresult = mysql_query( "SELECT * FROM phpbb_users INNER JOIN phpbb_sessions ON...
2
by: JaNE | last post by:
Maybe this isn't the most apropriate place to ask mysql related question, but I think it is close enought to most php users and I always got find answers on this group. well, I need to count how...
1
by: George | last post by:
Hi, I am trying to write a query in Oracle which I have not done before, and are having some difficulty getting my result. Please check my query and my results. select max(note.datetime),...
3
by: Ker | last post by:
I have a query that works great. It gives me the min for multiple fields. Within this query, I also need to get the max of some fields too. I currently have output of Date Name ...
3
by: MostlyH2O | last post by:
Hi Folks, I have a query that joins 3 tables. One of the tables (SalaryData) has data where there may be duplicate records with different dates. Of those duplicate records, I want the query to...
4
by: aamircheema | last post by:
Hi, Say I have a table Job with columns name, date, salary . I want to get the name ,date and salary for the date when that person earned maximum salary. I am using something like SELECT...
3
by: paii, Ron | last post by:
I have a sales table that logs sales information for each active job at the end of each month. My question is, will the following query give me the last sell price for each job in the sales table?...
3
by: jclover | last post by:
When creating a query in Access (assumption is the data has a unique ID which is numerical...new records, autonumber) how reliable is the "Last of" grouping function vs the "Max of" the ID, and then...
4
by: vincibleman | last post by:
Howdy all, Working my way into SQL from Access. Think I might have the hang of the basics, but would really appreciate a sanity check. The stored procedure listed below works, but I can't help...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.