Solved

Unequal multi-table update statement (Access)

Posted on 2008-10-03
4
622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:AaronAbend
ID: 22636337
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
ID: 22636347
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
ID: 22637135
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
ID: 31502838
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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

691 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