Update values in a table with results from a SELECT statement
Posted on 2009-07-03
I have a receipts table that contains a portion of information. I need to perform an update on this table where...
1) Table "A" is the table I need to update.
2) Table "B" contains values that are used in a caculation with values from table "B"
For example, table "A" contains:
Table "B" contains:
What I need to be able to do is update table "A" where
1) A.link_relationship = B.link_relationship
1) A.value1 = a.receipt_amt * B.hours_worked
2) A.value2 = a.receipt_amt / B.hourly_rate
Any help would be appreciated.
Direct SQL or stored procedure are good. This is a SQL Server 2005 release.