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)
 Statement explanation

Author  Topic 

callawayx14
Yak Posting Veteran

73 Posts

Posted - 2007-08-06 : 11:08:54
Can anyone help me with the statement below? I’m just looking for an explanation of what it does. I appreciate the help.

COUNT(DISTINCT CASE WHEN (DATEDIFF(wk, table_case.creation_time, table_close_case.close_date)=0 AND DATEDIFF(d,table_case.creation_time,table_close_case.close_date) <= 1)
OR (DATEDIFF(d,table_case.creation_time,table_close_case.close_date) <= 3) THEN table_case.id_number END) AS [Within 1 Bus. Day]


Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-06 : 11:23:41
it counts the occurances of id_number's when
table_case.creation_time and table_close_case.close_date are in the same week and the same day
OR
when the table_case.creation_time and table_close_case.close_date are less or equal to 3 days apart.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

callawayx14
Yak Posting Veteran

73 Posts

Posted - 2007-08-06 : 11:27:13
Thank you for your spirit1...I appreciate it.
Go to Top of Page
   

- Advertisement -