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 2005 Forums
 Transact-SQL (2005)
 query by date but not time

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2008-05-13 : 03:03:42
i want to query all my records and how many per date

so

select count(id),date from registrants group by date

but my problem is the date is a date time field so how can i just group it by date but not count the time?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-13 : 03:07:11
select count(id),dateadd(day,datediff(day,0,date),0) as date from registrants group by dateadd(day,datediff(day,0,date),0)

Madhivanan

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

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2008-05-13 : 03:22:17
thanks :)
Go to Top of Page
   

- Advertisement -