Solved

Count number of entries per day

Posted on 2011-02-23
6
507 Views
Last Modified: 2012-05-11
Hi

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.

0
Comment
Question by:jensjakobsen
6 Comments
 
LVL 32

Expert Comment

by:ewangoya
ID: 34963879

select convert(datetime, datefield, 101) as Daily, Count(*)
from table
group by Daily
0
 
LVL 1

Author Comment

by:jensjakobsen
ID: 34963928
Thanks for a very quick response.

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

Example:

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.
0
 
LVL 18

Accepted Solution

by:
sventhan earned 500 total points
ID: 34963945
select convert(varchar, datefield, 110) as Daily, Count(*)
from table
group by convert(varchar, datefield, 110)
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:jensjakobsen
ID: 34963988
Superb!!

I love you.
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34964073
Missed the group by
0
 
LVL 40

Expert Comment

by:Sharath
ID: 34964362
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

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now