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

total column in table

Status
Not open for further replies.

danieljoo

MIS
Oct 9, 2002
43
0
0
US
how do I total rows in a table?

ex.

ID EventA EventB EventC Total
1 50 10 20 80
2 0 10 20 30
 
Well, it looks like you were right with column, first off. Secondly, except in rare circumstances you don't want to store calculated values in your tables. Or repeating columns.

The first thing I would do is make a query that does that totalling for you and base any forms or reports on that query instead of the table. That way, if you update one of the columns that change will be reflected in the total automatically.

SELECT A, B, C, A + B + C AS TheTotal FROM tblWhatever

The next thing I would do is read up on Normalization. you can find a ton of resources by googling for it. I've got a great article by Paul Litwin copied on my website called "Fundamentals of Relational Database Design" that I recommend to a lot of people. Your table could use a bit of restructuring according to the rules of Normalization.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top