Solved

Unequal multi-table update statement (Access)

Posted on 2008-10-03
4
616 Views
Last Modified: 2011-10-19
My wife needs a database for her work in a school. It needs to track student reading scores and compare them to a target.

The way the target goal is figured out is to look at the first score for a student in a quarter and then add 2.5 (correct words per minute) per school week until the end of the quarter.

I made a table, tblSchoolWeeks, that has each week of the school year in it along with the increase amount based on where it falls in the quarter. That way some weeks, like during winter or spring breaks, dont count towards increasing the reading level.

So what I need help with, well that would be everything, what I most need help with is with an update query. A reading score and test date is entered into tblTestScores. What I want the update query to do is grab the first test score for that student in that quarter and then add the appropriate target increase number based on when the test took place (if it took place in the 3rd week of a quarter then the target is the first score for that quarter plus 5 points).

If you could help with the update query or if you have a better way of doing this I would appreciate it.

Attached is a picture of the current table layout.

Thanks.

TableExamples.JPG
0
Comment
Question by:zabu99
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:AaronAbend
Comment Utility
create view studentstartscoredate as select studentid, min(testdate) mintestdate from testscores

create view studentstartscore as select ts.studentid, ts.score
from testscores ts, studentstartscoredate tsd
where ts.studentid = tsd.studentid
and ts.testdate=tsd.testdate

select sw.startdate, sw.enddate, s.studentname, ss.score*sw.targetincrease/100.0 targetscore
from schoolweeks sw, students s, studentstartscore ss
where s.studentid= ss.studentid
order by ....

I have not tested this but you may get the idea from it.  You are going to get one row for each student for each week. So 10 students, 10 weeks, 100 records.

be careful - if ss.score is an integer, the result will be an integer.  
 
You can use temp tables intead of views... it may be easier
0
 
LVL 10

Accepted Solution

by:
AaronAbend earned 500 total points
Comment Utility
Error!!!
create view studentstartscoredate as select studentid, min(testdate) mintestdate
from testscores
GROUP BY STUDENTID

sorry about that...
0
 
LVL 5

Author Comment

by:zabu99
Comment Utility
That's going to take me a couple of minutes to wrap my brain around, but I'll get right on it. Thanks.
0
 
LVL 5

Author Closing Comment

by:zabu99
Comment Utility
Sorry to leave you hanging so long, I took on a bit of a cold on accident.

Yeah, if I modify this a little bit it should do the trick. Thanks for the (huge) push in the right direction.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now