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 |
|
allegin
Starting Member
1 Post |
Posted - 2012-02-01 : 06:16:03
|
| I have a problem which hopefully can be discussed and some kind of help given. I have a table that I can easily query for results such as createddatetime, closeddatetime and count etc. My query:select count (i.incidentnumber)[count], datepart(Day, i.createddatetime)[Day], datediff(day, createddatetime, closeddatetime)from incident i with (nolock)where i.actualsystem = 'system administration'and i.status = 'closed'and datepart (YYYY, i.createddatetime)='2012'and datepart (Month, i.createddatetime)='1'and datepart (day, i.createddatetime)='3'group by datepart (Day,i.createddatetime), i.closeddatetime, i.createddatetimeorder by datepart (Day,i.createddatetime)A little long winded but I added extras to narrow down the results. The goal is to have an output showing the number created per day and how long it took to close them down again. To make matters worse there are other criteria:1. From the creation date any number between 1 and 50 need to be closed within 3 days2. From the creation date any number between 51 and 100 need to be closed within 4 days3. And finally anything over 101 need to be closed within 5 daysThe above criteria should be taken into account each day. e.g 89 created - the first 50 have 3 days and the remaining 39 have 4 days. A mouthful and I hope I have explained it right. Certainly above my current skill level |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-01 : 09:26:18
|
| so can you show how you want expected output to come?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|