We help IT Professionals succeed at work.
Get Started

SQL, Date, Daily Row Count and Total Accumulated Row Count

430 Views
Last Modified: 2015-04-30
I need a Stored Procedure to return 'Date, Daily Row Count and Total Accumulated Row Count'?
So I thought this must be a simple common functionality and I could just find something on Google to modify???

I have a table with new signups daily, capturing the CID and CreateTime.  Of course the boss wants to know how many each day and how many in total.  I have not been able to get "Group By Date" to work, I think, however I Cast, Convert, Trim, or Format SQL sees each smallDateTime as a "new different Group" due to the time portion of smallDateTime, I think I got smallDateTime Converted to just a Date, but then I can't use the alias in the Group By clause.  Hmmm?

Table-
CID I smallDateTime
1   I 2015-04-28 06:33:00
2   I 2015-04-28 06:34:00
3   I 2015-04-28 06:36:00
4   I 2015-04-29 06:00:00
5   I 2015-04-29 06:02:00
6   I 2015-04-30 05:00:00

Result(desired)
Date        I Count I Total
2015-04-28  I     3 I  3
2015-04-29  I     2 I  5
2015-04-30  I     1 I  6      

Thanks for the assistance.
Sam
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE