how to create a query that count a few things

M

mish

I have a Member Table and below is it's struture.

Field: Name,Sport,Computer,Movie,Music

Description:
Member's Name
Is Sport your hobby ? 0-no 1-yes (interger)
Is Computer your hobby ? 0-no 1-yes (interger)
Is movie your hobby ? 0-no 1-yes (interger)
Is music your hobby ? 0-no 1-yes (interger)

I want to create a query that count how many people like Sport , computer,
movie and music. (count if the record for that field is "1")
so the query result should look something like this:

Sport 13
Computer 28
movie 30
music 40

or

sport computer movie music
13 28 30 40

thx in advance
 
D

Duane Hookom

Try SQL like:
SELECT Sum([Field1]) as SumField1, Sum([Field2]) as SumField2,
Sum([Field3]) as SumField3,Sum([Field4]) as SumField4
FROM [Member Table];

Do you understand your table is not normalized?
 

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