Hey guys,
I just got in a SQL class and its for ultranoobs like me =)
Anyhow, I was struggling with a concept. We are just doing basic queries and using MS Access.
I have a database that includes 5 attributes:
1) AccidentDate (Year, Number)
2) AccidentLocation (Street, Text String)
3) Damages (Currency, Number)
4) ReportNumber (Number)
5) CarLicense (Number)
It is a relation that describes an accident ticket for an insurance company.
My goal is to return the LOCATION of the accident with the highest damages in 2006.
So far I can get the highest damages easily with the following code:
CODE
SELECT MAX(A.Damages)
FROM Accident A
WHERE A.AccidentDate LIKE '2006';
But if I put anything in like the following, it tells me that AccidentLocation is not in the aggregate function...whatever that means....
CODE
SELECT A.AccidentLocation,MAX(A.Damages)
FROM Accident A
WHERE A.AccidentDate LIKE '2006';
I just don't know how to get it to show the location when its not part of the logic at all....
Any help would be greatly appreciated!