Sum Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to make a query that will return the sum of a column. The columns are
all the months of the year. If you do a query that says Sum:sum([January]).
You will get the sum of the January column, but I want to be able to call the
month I want to show the totals for(a parameter query in the equation). I
thought Sum:sum([which]) would work, but it doesn't. Is there another way?
 
If your table was normalized, you wouldn't have this problem. You can try
something like:

SELECT Sum(Choose([Enter the Month Number],[January], [February], [March],
....[December])) as MthlyTotal
FROM tblSpreadsheet;
 
Can you tell me a place I can read about Properly setting up tables so that
they are Normalized? I am not sure I understand what you mean. Your soution
worked, but I am worried about the stability of the database now that you say
that.

Duane Hookom said:
If your table was normalized, you wouldn't have this problem. You can try
something like:

SELECT Sum(Choose([Enter the Month Number],[January], [February], [March],
....[December])) as MthlyTotal
FROM tblSpreadsheet;


--
Duane Hookom
MS Access MVP
--

Nikki said:
I want to make a query that will return the sum of a column. The columns
are
all the months of the year. If you do a query that says
Sum:sum([January]).
You will get the sum of the January column, but I want to be able to call
the
month I want to show the totals for(a parameter query in the equation). I
thought Sum:sum([which]) would work, but it doesn't. Is there another
way?
 
http://www.google.com/search?query=Database+Normalize+Access

--
Duane Hookom
MS Access MVP
--

Nikki said:
Can you tell me a place I can read about Properly setting up tables so
that
they are Normalized? I am not sure I understand what you mean. Your
soution
worked, but I am worried about the stability of the database now that you
say
that.

Duane Hookom said:
If your table was normalized, you wouldn't have this problem. You can try
something like:

SELECT Sum(Choose([Enter the Month Number],[January], [February],
[March],
....[December])) as MthlyTotal
FROM tblSpreadsheet;


--
Duane Hookom
MS Access MVP
--

Nikki said:
I want to make a query that will return the sum of a column. The
columns
are
all the months of the year. If you do a query that says
Sum:sum([January]).
You will get the sum of the January column, but I want to be able to
call
the
month I want to show the totals for(a parameter query in the equation).
I
thought Sum:sum([which]) would work, but it doesn't. Is there another
way?
 
Back
Top