Running Total Query Yeilds Different Results - Why?

G

gljones3

I am generating a running sum of Shares for an investment tracking
database in a query as follows: (SELECT Sum([Shares]) FROM
[Transactions] AS [Transactions_1] WHERE [Transactions_1].[Period#] <=
[Transactions].[Period#] AND [Transactions_1].[Security] =
[Transactions].[Security]). The problem is each time I run it, I get a
different number of records, even though I'm not making any changes to
the query or the data. It seems to randomly drop 1, 2, 3, or more
records each time. Some times it will be right, but it seems random.

Any Ideas? Thanks for the help.
Greg
 
T

Tom Ellison

Dear Greg:

(SELECT Sum([Shares]) FROM
[Transactions] AS [Transactions_1]
WHERE [Transactions_1].[Period#] <= [Transactions].[Period#]
AND [Transactions_1].[Security] = [Transactions].[Security])

This must be a subquery fragment of a larger query, right?

How about posting the whole query, please.

Is the combination of columns Security/Period# unique taken together?

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top