Count number of entries per day


I need to count the numbers of entries per day in a database.

Then I need the result to be displayed so that I can see how many entries there were per day.

Who is Participating?
sventhanConnect With a Mentor Commented:
select convert(varchar, datefield, 110) as Daily, Count(*)
from table
group by convert(varchar, datefield, 110)
Ephraim WangoyaCommented:

select convert(datetime, datefield, 101) as Daily, Count(*)
from table
group by Daily
jensjakobsenAuthor Commented:
Thanks for a very quick response.

However that example showed me the number of 1 (one) per entry.


If the date 02/02/2011 had 12 entries I get 12 entries and not 02/02/2011 = 12

Let me know if I'm unclear.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

jensjakobsenAuthor Commented:

I love you.
Ephraim WangoyaCommented:
Missed the group by
SharathData EngineerCommented:
You can simply convert to DATE if you are on SQL Server 2008.
select convert(date, datefield) as Daily, Count(*) Cnt
from table1
group by convert(date, datefield)

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.