Solved

Count number of entries per day

Posted on 2011-02-23
6
510 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server - Sum Decimal Columns 11 45
date diff with Fiscal Calendar 4 57
TSQL convert date to string 4 37
Need return values from a stored procedure 8 21
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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