Counting up Yes/No fields in queries

J

Joachim

I have an access table where i need to make a query to count the meals they
eat in school in a week for a group of people.
In the query i want to show the name of the person and how many meals he
eats a week at school;
In my table i've made yes/no fields a day for those people ,
so actually i need to make a query who counts to yes' of the 5 yes/no fields .
 
K

KARL DEWEY

Try this --
SELECT Name, Abs(Sum([Mon] + [Tue] + [Wed] + [Thu] + [Fri]))
FROM YourTable
GROUP BY Name;
 
J

Joachim

Where do i have to fill in SELECT Name, Abs(Sum([Mon] + [Tue] + [Wed] + [Thu]
+ [Fri])) ?

--
Looking forward to your reply

thx already


KARL DEWEY said:
Try this --
SELECT Name, Abs(Sum([Mon] + [Tue] + [Wed] + [Thu] + [Fri]))
FROM YourTable
GROUP BY Name;

--
Build a little, test a little.


Joachim said:
I have an access table where i need to make a query to count the meals they
eat in school in a week for a group of people.
In the query i want to show the name of the person and how many meals he
eats a week at school;
In my table i've made yes/no fields a day for those people ,
so actually i need to make a query who counts to yes' of the 5 yes/no fields .
 
K

KARL DEWEY

What I posted was SQL for a query.
Or open a select query in design view, click on the icon that looks like
an 'M' on its side - ∑ to change from select to totals query.
In the field row have only name. Paste this in a blank of the field row --
Meals: Abs([Mon] + [Tue] + [Wed] + [Thu] + [Fri])
In the Totals row change the Group By to Sum.

--
Build a little, test a little.


Joachim said:
Where do i have to fill in SELECT Name, Abs(Sum([Mon] + [Tue] + [Wed] + [Thu]
+ [Fri])) ?

--
Looking forward to your reply

thx already


KARL DEWEY said:
Try this --
SELECT Name, Abs(Sum([Mon] + [Tue] + [Wed] + [Thu] + [Fri]))
FROM YourTable
GROUP BY Name;

--
Build a little, test a little.


Joachim said:
I have an access table where i need to make a query to count the meals they
eat in school in a week for a group of people.
In the query i want to show the name of the person and how many meals he
eats a week at school;
In my table i've made yes/no fields a day for those people ,
so actually i need to make a query who counts to yes' of the 5 yes/no fields .
 

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