How to update using a query?

P

pokdbz

I have a seperate query made that calculates a total score.

SELECT MOCA.STUDYID,
[Moca_S1]+[Moca_S2]+[Moca_S3]+[Moca_S4]+[Moca_S5]+[Moca_S6]+[Moca_S7] AS
Score, MOCA.Moca_EDU, IIf([Moca_EDU]=1,[Score]+1,[Score]) AS NewScore,
IIf([NewScore]>30,30,[NewScore]) AS FinalScore
FROM MOCA;

I need to update a field in the table called CalcScore using this query for
each STUDYID.

I tried making a update query and put in
[TotalScoreUpdateQuery].[FinalScore] for the Update to but that didn't work.
 
O

Ofer Cohen

It's not recomended storing a calculated field, you'll have to keep
maintaining it, and keep running an update query to update te right values.

If you can already get the resaults using a select query then keep on using
it, it's just like a table in your databse that the calculated fields in it
will always be updated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top