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 |
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2007-08-06 : 12:49:25
|
Can anyone explaine what this statement is doing COUNT(DISTINCT CASE WHEN DATEDIFF(d,table_case.creation_time,table_close_case.close_date) - (DATEDIFF(wk, table_case.creation_time, table_close_case.close_date) * 2) <= 10 THEN table_case.id_number END) AS [Within 10 Bus. Days]Thank again!!! |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-06 : 12:55:41
|
Hint: [Within 10 Bus. Days]Count of all cases whose close_date is within 10 business days of the creation_time... ?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2007-08-06 : 12:57:24
|
I assumed that based on the field name but I don't understand the calculation |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-06 : 13:15:38
|
::DATEDIFF(d,table_case.creation_time,table_close_case.close_date) will give datediff in Days between close_date and creation_time.::DATEDIFF(wk, table_case.creation_time, table_close_case.close_date) will give datediff in weeksI dont know why there is a >>> *2 If the diff between the two above <= 10, then get the CaseID and COUNT it.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2007-08-06 : 13:34:34
|
Is it subtracting the weeks from the days and then multiplying the result by 2? |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-06 : 14:13:34
|
Get the weeks (between open/close dates),Multiple by 2,then subtract it from days (between open/close dates).Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2007-08-06 : 14:30:55
|
Dinakar has the logoc correct. It appears the intention is to subtract weekends (Weeks *2) off the number of days to get a business days duration. |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2007-08-06 : 15:05:20
|
Thank you very much....I sincerely appreciate your help |
 |
|
|
|
|