Hi there, I really need help very fast with this SQL query can anyone help me please??
This is for an Access97 Database about a school athletics carnival…
Here are the tables:
event = [age, event, record, apparatus]
eventdetails = [eventNo, age, event, division, time]
points = [division, place, points]
recordholder = [age, event, student, year]
results = [student, eventNo, place, result]
student = [student, house]
trophies = [trophy, requirement, age, event]
Assume that all the names have relationships correct.
Now here’s my problem, I have to write an SQL query that adds up all the points that each house gets (12 houses), every house has students that compete in one or more event and that students is given a place, if the division that student was competing in was the same as the division in the points table and the place the student got was the same then his house gets that many points.
I have written this but I get error messages that I can’t fix:
SELECT student.house, sum(points.points)
FROM student, points, eventdetails, results
GROUP BY student.house
HAVING events.division = points.division AND
results.place = points.place AND results.eventNo = events.eventNo;
It says “Can’t execute a query that doesn’t used the specified expression” and then gives me everything after the word “HAVING”.
Please help me, I know I shouldn’t have left it this long to ask all you people, I have learnt a valuable lesson from this… if you need help then ask. I have about 12 hours till I have to hand it in.
If you need any more info please ask for it.
PerfectDark