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 |
Makaio780
Starting Member
24 Posts |
Posted - 2012-02-15 : 11:48:37
|
Select count(vars75_hpd_help_desk_1.incident_number)as tktcount,derivedtbl_1.FCR,Month(Reported_date) as mthfrom vars75_hpd_help_desk as vars75_hpd_help_desk_1 inner joinvTbl_ServiceDeskAnalystList ON vARS75_HPD_Help_Desk_1.Owner = vTbl_ServiceDeskAnalystList.[Full Name] CROSS JOIN(SELECT COUNT(Incident_Number) AS FCR,Month(Reported_date) as mthFROM vARS75_HPD_Help_DeskWHERE (Assigned_Group = 'HD-Edmonton' ORAssigned_Group = 'HD-Edmonton-1.5') AND (Reported_Source = 'Phone') AND (Last_Resolved_Date <= DATEADD(ss, 3600, Reported_Date)) AND (Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0))and ( Reported_date < dateadd(month, datediff(month, 0, getdate()), 0))group by month(reported_date)) AS derivedtbl_1where reported_Source = 'phone' and (Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0))and ( Reported_date < dateadd(month, datediff(month, 0, getdate()), 0))group by month(reported_date),derivedtbl_1.FCRtktcountFCR Mth5653 2041 13902 2041 24339 2041 33938 2041 44565 2041 54792 2041 63920 2041 74595 2041 85074 2041 94752 2041 105197 2041 114407 2041 125653 2234 13902 2234 24339 2234 33938 2234 44565 2234 54792 2234 63920 2234 74595 2234 85074 2234 94752 2234 105197 2234 114407 2234 125653 2328 13902 2328 24339 2328 33938 2328 44565 2328 54792 2328 63920 2328 74595 2328 85074 2328 94752 2328 105197 2328 114407 2328 125653 2392 13902 2392 24339 2392 33938 2392 44565 2392 54792 2392 63920 2392 74595 2392 85074 2392 94752 2392 105197 2392 114407 2392 125653 2680 13902 2680 24339 2680 33938 2680 44565 2680 54792 2680 63920 2680 74595 2680 85074 2680 94752 2680 105197 2680 114407 2680 125653 2685 13902 2685 24339 2685 33938 2685 44565 2685 54792 2685 63920 2685 74595 2685 85074 2685 94752 2685 105197 2685 114407 2685 125653 2706 13902 2706 24339 2706 33938 2706 44565 2706 54792 2706 63920 2706 74595 2706 85074 2706 94752 2706 105197 2706 114407 2706 125653 2772 13902 2772 24339 2772 33938 2772 44565 2772 54792 2772 63920 2772 74595 2772 85074 2772 94752 2772 105197 2772 114407 2772 125653 2913 13902 2913 24339 2913 33938 2913 44565 2913 54792 2913 63920 2913 74595 2913 85074 2913 94752 2913 105197 2913 114407 2913 125653 2974 13902 2974 24339 2974 33938 2974 44565 2974 54792 2974 63920 2974 74595 2974 85074 2974 94752 2974 105197 2974 114407 2974 125653 3025 13902 3025 24339 3025 33938 3025 44565 3025 54792 3025 63920 3025 74595 3025 85074 3025 94752 3025 105197 3025 114407 3025 125653 3520 13902 3520 24339 3520 33938 3520 44565 3520 54792 3520 63920 3520 74595 3520 85074 3520 94752 3520 105197 3520 114407 3520 12How would I group the FCR column by month?Ron Cheung |
|
X002548
Not Just a Number
15586 Posts |
|
Makaio780
Starting Member
24 Posts |
Posted - 2012-02-15 : 12:38:36
|
In the end i would like to combine 2 tables i guess grouped by month.TktCount Mth5689 13931 24367 33966 44628 55006 63961 74645 85107 94776 105214 114417 12FCR mth3520 12041 22392 32234 42685 52913 62328 72706 82974 92772 103025 112680 12below is the queuries.Select count(incident_number)as tktcount,Month(Reported_date) as mthfrom vars75_hpd_help_deskwhere reported_Source = 'phone' and (Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0)) and ( Reported_date < dateadd(month, datediff(month, 0, getdate()), 0))group by month(reported_date)SELECT COUNT(Incident_Number) AS FCR,Month(Reported_date) as mth FROM vARS75_HPD_Help_Desk WHERE (Assigned_Group = 'HD-Edmonton' OR Assigned_Group = 'HD-Edmonton-1.5') AND (Reported_Source = 'Phone') AND (Last_Resolved_Date <= DATEADD(ss, 3600, Reported_Date)) AND (Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0)) and ( Reported_date < dateadd(month, datediff(month, 0, getdate()), 0))group by month(reported_date)Ron Cheung |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2012-02-15 : 13:03:10
|
Does this help?SELECT Source, YEAR(Report_Date) AS YR, MONTH(Report_Date) AS MTH, COUNT(*) AS Row_Counts FROM ( SELECT 'TICKET' AS Source, Reported_date, Incident_Number FROM vars75_hpd_help_desk WHERE reported_Source = 'phone' AND (Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0)) AND ( Reported_date < dateadd(month, datediff(month, 0, getdate()), 0)) UNION ALL SELECT 'FCR' AS Source, Reported_date, Incident_Number FROM vars75_hpd_help_desk WHERE ( Assigned_Group = 'HD-Edmonton' OR Assigned_Group = 'HD-Edmonton-1.5') AND Reported_Source = 'Phone' AND (Last_Resolved_Date <= DATEADD(ss, 3600, Reported_Date)) AND Reported_date > dateadd(mm,datediff(mm,0,getdate())-12,0) AND Reported_date < dateadd(month, datediff(month, 0, getdate()), 0)) AS XXXGROUP BY Source, YEAR(Report_Date), MONTH(Report_Date) Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/ |
|
|
Makaio780
Starting Member
24 Posts |
Posted - 2012-02-15 : 13:23:03
|
Thanks for the reply... im sure i could use this somehow!!! thanks again!Ron Cheung |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|