Total Not Count

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

Guest

SELECT Count([Log table].Log) AS [6 South], [Log table].Date, [Log table].Room
FROM [Log table]
WHERE ((([Log table].Room) Between "603" And "641"))
GROUP BY [Log table].Date, [Log table].Room;


I need a Total count of the first field called 6 South....instead I get a
number 1 for every entry. I tried sum but that doesnt work either. I know I
am doing something really basic but can anyone please help me Im just a
beginner. Thank you in advance.
 
ferde said:
SELECT Count([Log table].Log) AS [6 South], [Log table].Date, [Log table].Room
FROM [Log table]
WHERE ((([Log table].Room) Between "603" And "641"))
GROUP BY [Log table].Date, [Log table].Room;


I need a Total count of the first field called 6 South....instead I get a
number 1 for every entry. I tried sum but that doesnt work either. I know I
am doing something really basic but can anyone please help me Im just a
beginner. Thank you in advance.

You are getting totals of [6 South] broken at every [Date] and [Room]
because of the GROUP BY clause.

How about

SELECT Count([Log table].Log) AS [6 South]
FROM [Log table]
WHERE ((([Log table].Room) Between "603" And "641"));

BTW "Date" is not a good field name because it is an Access reserved
word. Suggest "MyDate", "RoomDate", etc.

HTH
 
ferde said:
Yes but it gives me the Log number . I need to have access total the
field
LOG TABLE.

Then why ask for:
I need a Total count of the first field called 6 South...

and it appears from :

SELECT ..... FROM [Log table]

That [Log Table] is a table, not a field.

When you decide which field you want to total

SUM([that field])

will total it across the range selected by your WHERE clause.

If [log] is that field then changing COUNT to SUM should fix it.
ferde said:
SELECT Count([Log table].Log) AS [6 South], [Log table].Date, [Log
table].Room
FROM [Log table]
WHERE ((([Log table].Room) Between "603" And "641"))
GROUP BY [Log table].Date, [Log table].Room;


I need a Total count of the first field called 6 South....instead I get
a
number 1 for every entry. I tried sum but that doesnt work either. I
know I
am doing something really basic but can anyone please help me Im just a
beginner. Thank you in advance.
 
Back
Top