From: Mary Phelps on
I have a table Contest with ContestId (PK int), ContestName,
ContestDate. I have another table Registration which stores the data
for people who register for the contest. Registration has
RegistrationId (PK int), ContestId (FK int) , PersonsName (varchar),
Isawinner(bit)
I would like a query which would return me the following results:
ContestDate. ContestName, count of registrations for that date, count
of winners for that date
From: Tom Cooper on
Select c.ContestDate,
c.ContestName,
Count(*) As NumberOfRegistrations
Sum(Cast r.Isawinner As int)) As NumberWinners
From Contest c
Inner Join Registration r
Group By c.ContestDate, c.ContestName;

Tom

"Mary Phelps" <icanhelp33(a)gmail.com> wrote in message
news:6088aa48-3abd-47d1-893a-cf58fddd7652(a)m17g2000prl.googlegroups.com...
>I have a table Contest with ContestId (PK int), ContestName,
> ContestDate. I have another table Registration which stores the data
> for people who register for the contest. Registration has
> RegistrationId (PK int), ContestId (FK int) , PersonsName (varchar),
> Isawinner(bit)
> I would like a query which would return me the following results:
> ContestDate. ContestName, count of registrations for that date, count
> of winners for that date