Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

tricky update

Posted on 2009-02-10
2
Medium Priority
?
171 Views
Last Modified: 2012-05-06
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....)

0
Comment
Question by:Wirt
2 Comments
 
LVL 25

Accepted Solution

by:
reb73 earned 2000 total points
ID: 23602288
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
 

Author Closing Comment

by:Wirt
ID: 31545113
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

578 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