My SQL skills are more than a little rusty (in fact, it's been at least 5 years since I last looked at SQL!) and I'm struggling to get a statement to work the way I want it to, can anybody help?
It might help to know I'm doing this as an Access query, although I was under the impression that Access has no problems handling SQL in the same way a server would (correct me if I'm wrong!).
What I have is 3 tables, 'Students', 'Achievements' and 'Behaviour'. All 3 have a column for 'Admission', and this is how the 3 are joined. From 'Students', I want to get the 'Reg', 'Surname' and 'Forename'. From 'Achievements' and 'Behaviour', I want the sum of 'Points' for each individual student between certain dates (a form pops up before running the report this query is based on that passes these dates to the query).
So, on to the statement I've tried (It's not exactly as I originally typed it, Access seems to automatically format it when you exit SQL view):
If I try to run this query, I simply get the error "You tried to execute a query that does not include the specified expression 'Forename' as part of an aggregate function."Code:SELECT Students.Admission, Students.Forename, Students.Surname, Students.Reg, Achievements.ADate, Behaviour.BDate, Sum(Achievements.Points) AS SumOfPoints, Sum(Behaviour.Points) AS SumOfPoints1
FROM Achievements INNER JOIN (Behaviour INNER JOIN Students ON Behaviour.Admission = Students.Admission) ON Achievements.Admission = Students.Admission
WHERE (((Achievements.ADate)>=[Forms].[ReportFilter]![txtStartDate] And (Achievements.ADate)<=[Forms].[ReportFilter]![txtEndDate]) AND ((Behaviour.BDate)>=[Forms].[ReportFilter]![txtStartDate] And (Behaviour.BDate)<=[Forms].[ReportFilter]![txtEndDate]))
GROUP BY Students.Admission;
Any ideas? I'm getting a real headache over this one, I really wish I'd done a bit more with SQL over the years to keep myself up to scratch!

