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
 Transact-SQL (2000)
 COUNT on date field

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-02 : 07:57:08
ZAID writes "Hello Team,

I have a table with the faloowing data example:

Query,Date
red,2/1/2006
red,2/1/2006
blue,2/1/2006
white,2/26/2006
red,2/26/2006
blue,2/26/2006
white,2/27/2006
red,2/27/2006
blue,2/27/2006

What I am trying to do is get a COUNT of how many records there are for a particular Query for the Day, Week, and Month

So from the above example I want the following returned:
Query,Day,Week,Month
red,1,2,4
white,1,2,2
blue,1,2,3

Thank you for your time"

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-03 : 01:49:55
ZAID, can you explain how do you get the count for column Day & Week ? Which Day or Week is it ?

----------------------------------
'KH'


Go to Top of Page
   

- Advertisement -