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.
Author |
Topic |
Lemmy44
Starting Member
20 Posts |
Posted - 2007-02-08 : 14:57:13
|
I have been asked to come up with a report on how many days a client has received service in a given time frame. It is possible to have serviced a client more than once per day, but they only want to count it once. For example, a client was serviced 4 times on Monday, that would only count as one day.I have used the following syntax:COUNT(DISTINCT DAY(contact.contact_date))What I have run into, is that if my count spans over a couple of months, the same day(January 15 & Febuary 15 for example) will only be counted as one day, when I want it to count as two days.Any suggestions on how I can pull this off?Thanks,Lemmy |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-02-08 : 15:00:22
|
COUNT(DISTINCT convert(varchar(8),contact.contact_date,112))==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
Lemmy44
Starting Member
20 Posts |
Posted - 2007-02-08 : 15:29:33
|
OK...thanks.I feel a little dumb for not trying that, but it works so I'm not comlaining. |
 |
|
|
|
|