tricky update

I have two tables PMT_TAB and PMT_STEPS there are many steps within one Tab. My problem is, I need to calulate the sum of all the time spent for each step with in each Tab and update the PMT_TAB table with that result:
Rough example
Update PMT_TAB
SET TAB_TIME = .... (Select ...,Sum(STEP_TIME) FROM PMT_STEPS where....)

WirtAsked:
Who is Participating?
 
reb73Commented:
One of the two below will work depending on whether you have a keyfield that can be joined -

UPDATE PMT_TAB
SET TAB_TIME = (Select SUM(STEP_TIME) FROM PMT_STEPS)

UPDATE PMT_TAB
SET TAB_TIME = (Select SUM(STEP_TIME) FROM PMT_STEPS WHERE PMT_TAB.<KeyField> = PMT_STEPS.<KeyField>)
0
 
WirtAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.