Solved

Storing cumulative data

Posted on 2008-10-02
6
216 Views
Last Modified: 2013-11-28
how do you create a "bucket" for numbers and store them in a seperate field in a query?  Example: I have detail records that have data stored in a field called Accural 1which has the following data in detail records:Record 1= .0245, Record 2 = .0358, Recordl 3 = .458.  The bucket or new field would show the total or  .5183 in this example.
0
Comment
Question by:mogurek
  • 2
6 Comments
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 168 total points
ID: 22630680
To get sum, you can just do this:
SELECT SUM([Accrual 1]) AS TotalAccural

FROM yourTableName

Open in new window

0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 166 total points
ID: 22630683
it is not advisable to store calculated values in a table.

yuo can always get the total value by using sum or dsum functions

in a query assuming you have a recordId and Accural 1 fields

select recordID, sum([Accural 1]) as TotalAccural
group by recordID
0
 
LVL 9

Assisted Solution

by:jamesgu
jamesgu earned 166 total points
ID: 22630688

select Accural_1, (select sum(Accural_1) from table_name) as bucket
from table_name
0
 
LVL 9

Expert Comment

by:jamesgu
ID: 22630701
agree with capricorn1:

if one of the value is changed, the sum value will become incorrect,
or you may have to update the sum value as well.


0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now