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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

totaling values in table

Status
Not open for further replies.

bill1one

Programmer
Sep 29, 2004
93
US
I have a table made up of 8 weeks. Each week has its on column with a unique value. I want the final column to be a total for that entire week. How can this be done?
 
I quite don't understand your schema.
Could you please post your table's structure ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
My table looks like this

Week 1 | week 2 | week 3 | etc. | TOTAL <-- heading
----------------------------------------
3 | 4 | 4 | 3 | x <-- data
----------------------------------------
2 | 4 | 3 | 3 | x

 
SELECT [Week 1], [Week 2], ..., [Week 8]
, Nz([Week 1], 0) + Nz([Week 2], 0) + ... + Nz([Week 8], 0) AS TOTAL
FROM yourTable

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
First, you're table structure isn't normalized and this is going to cause you problems in the future. Secondly, you shouldn't store calculated numbers in a table. From your table description, I would guess you are "committing spreadsheet". Suggest you read The Fundamentals of Relational Database Design.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Oh, That makes sense. I got it to work anyhow by totaling the values on the report, which is where I needed them to total.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top