473,289 Members | 1,723 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,289 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 7000

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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.