Created
September 27, 2018 19:37
-
-
Save aevdokimenko/2498a2ce677c544d3ceffbbcfd007024 to your computer and use it in GitHub Desktop.
Get stats on the cases in Salesforce using DBAmp + MS SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
status, format(max(TTR), 'N') max, | |
format(min(TTR), 'N') min, | |
format(avg(TTR), 'N') avg | |
from ( | |
select status, TTR = 1.0 * datediff(minute, createddate, isnull(closeddate, getdate()))/60 | |
from openquery(salesforce, | |
'select status, createddate, closeddate | |
from case | |
where origin = ''GC'' and | |
createddate = LAST_N_DAYS:10'))t | |
group by status | |
order by status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment