0

I need to count the number of records in my query with the same EventDate. Here is my query:

SELECT EventName, EventDate
FROM Schedule s
JOIN Groups g
ON s.GroupID = g.GroupID
JOIN Organizations o
ON g.OrganizationID = o.OrganizationID
WHERE o.OrganizationID = 2
AND s.CreateDate > o.EvalEndDate
ORDER BY ID

And here is the first chunk of the result set:

enter image description here

I need to know how many records in this list have the same exact EventDate. If I use GROUP BY, I do get the correct number of rows -- but I don't need to see all the rows; I only need the count. A single number. How do I do this? For this query, it so happens that there are exactly 2 records for each datetime. The raw query produces 108 records, which means the count I am looking for is exactly half that: 54. I need a query that gives me that count.

IMPORTANT: I cannot just do a count(*) and divide that by 2, because there is no guarantee there will always be 2 records for each date. It will be a common occurrence, but there will be variances.

HerrimanCoder
  • 6,835
  • 24
  • 78
  • 158

0 Answers0