473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help creating a "count" query

emandel
65
I have a db with a table called "events" a table "participants" and the table linking them together is "attendance" this gives me a many to many relationship. I first record in a form the nature of the event and then record who from the "participants" attended each event.

I would like to create a query, whereby at each event it counts the attendees that came. Please can someone walk me through this.

Thank you,
Oct 28 '07 #1
2 2124
ADezii
8,834 Expert 8TB
I have a db with a table called "events" a table "participants" and the table linking them together is "attendance" this gives me a many to many relationship. I first record in a form the nature of the event and then record who from the "participants" attended each event.

I would like to create a query, whereby at each event it counts the attendees that came. Please can someone walk me through this.

Thank you,
ASSUMPTIONS:
  1. Attendance is the Linking Table with a Composite Primary Key consisting of the [EventID] and [ParticipantID] Fields, with the following Relationships defined:
    1. Events.[EventID](1) ==> Attendance.[EventID](MANY)
    2. Participants.[ParticipantID](1) ==> Attendance.[ParticipantID](MANY)
  2. The SQL for determining the Count of Attendees per Event, by Event Name, would be (assumes a Name Field exists in the Events Table:
    Expand|Select|Wrap|Line Numbers
    1. SELECT Events.Name, Count(Attendance.EventID) AS Total_Attending
    2. FROM Events INNER JOIN Attendance ON Events.EventID = Attendance.EventID
    3. GROUP BY Events.Name;
Oct 28 '07 #2
emandel
65
Thank you that worked!
Oct 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Nicolae Fieraru | last post by:
Hi All, I have a query, Select Count(BoolField) from tblMyTable, Where BoolField = true. If I run the query by itself, it returns the number of true records I want to use the result of that...
1
by: James | last post by:
Access 2003, trying to count the number of records that meet a criteria. According to Help: "In the Database window, click Queries under Objects, and then click New on the database window...
3
by: Rabun | last post by:
Heres one that is giving me fits ( = = Access newbie), more than likely something simple that I blew right over . . . any help is appreciated - I have a report based on a query, with several...
0
by: chris.bender | last post by:
1. My problem: I am using a query to populate a Chart in MS Access 2k. 2. My query: SELECT .Status, ., Sum(.Amount) AS SumOfAmount, Sum(IIf(!="Debit",!,!*-1)) AS realAmount, Count(.Status) AS...
1
by: Greg Smith | last post by:
I am trying to write a SQL query that will return a record count to my C# application. I wrote the following query: ALTER PROCEDURE up_justification_duplicate AS SELECT COUNT(*) FROM...
6
by: dBNovice | last post by:
Hey group, I am trying to do a count of the number of papers in a table. The table has a PaperID that differentiates each paper , e.g. 004.1. Some papers are reused. The reused paper is given...
1
by: Drifter | last post by:
Hi I have the following data in a table: From To a to b a to b a to c b to c b to c
2
by: Jschraepf | last post by:
I'm working in visual web developer and i want to use the results of a count query but i don't know how to get them. I am using a select statment: SELECT Count(Record) From " &...
3
WyvsEyeView
by: WyvsEyeView | last post by:
This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.