Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Update with a Sum statement

Status
Not open for further replies.
Joined
May 1, 2006
Messages
35
Location
US
Good Afternoon

I have a simple update statement with a sum that should happen in access. I used the design view to come up with this SQL statement. But I am using Access to update the table. The following is the code:
Code:
UPDATE dbo_T_OCCPT INNER JOIN [TBL_Phase II Master - v2 JANITOR] ON dbo_T_OCCPT.CST_CTR_CD = [TBL_Phase II Master - v2 JANITOR].[Occupant / Retail Cost Center] 
SET [TBL_Phase II Master - v2 JANITOR].[Square Footage] = [dbo_T_OCCPT].[OCCPT_RSF_QTY];
I am assuming that there should be a set statment like this:
[blue]
Code:
SET [TBL_Phase II Master - v2 JANITOR].[Square Footage] = sum([dbo_T_OCCPT].[OCCPT_RSF_QTY]);
[/blue]
For a little bit of background, the Occpt_rsf_qty should be a sum for each and every building. I have tried, but this does not work. If you can think of anything to fix this problem, let me know.



~ a journey of a thousand miles must begin with a single step ~
 
Something like this ?
UPDATE [TBL_Phase II Master - v2 JANITOR]
SET [Square Footage] = DSum("OCCPT_RSF_QTY","dbo_T_OCCPT","CST_CTR_CD='" & [Occupant / Retail Cost Center] & "'")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top