Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Count of Records for All date

Author  Topic 

besadmin
Posting Yak Master

116 Posts

Posted - 2008-08-11 : 15:16:25
Hey friends. We have a SQL table, one of the fields is the date the record was entered. How would we go about finding the number of records created for every date in the table?

Any help on this issue is greatly appreciated.

Thanks again!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-11 : 15:25:13
SELECT DATEADD(DAY, DATEDIFF(DAY, 0, DateCol), 0),
COUNT(*)
FROM Table1
GROUP BY DATEADD(DAY, DATEDIFF(DAY, 0, DateCol), 0)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-12 : 02:20:48
quote:
Originally posted by Peso

SELECT DATEADD(DAY, DATEDIFF(DAY, 0, DateCol), 0),
COUNT(*)
FROM Table1
GROUP BY DATEADD(DAY, DATEDIFF(DAY, 0, DateCol), 0)



E 12°55'05.25"
N 56°04'39.16"



Did you forget your style?

SELECT DATEADD(DAY, DATEDIFF(DAY, '19000101', DateCol), '19000101'),
COUNT(*)
FROM Table1
GROUP BY DATEADD(DAY, DATEDIFF(DAY, '19000101', DateCol), '19000101')


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-12 : 02:57:31
Nah, I thought I would help you bump your post count.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -