CAST((100.0 * sum(qso_ct)/sum(eval_ct)) AS DECIMAL(18, 1)) as siteSum,
CSS
<cfquery name="LOCAL.qryResultsTrend" datasource="opscall">
select question
, CAST((100.0 * SUM(CASE WHEN answer = 'yes' AND week = '#variables.lastweek#' THEN count else NULL END)/SUM(CASE WHEN week = '#variables.lastweek#' THEN count else 0 END)) AS DECIMAL(18, 2)) as 'LASTWEEK'
, CAST((100.0 * SUM(CASE WHEN answer = 'yes' AND month = '#variables.MTD#' THEN count else NULL END)/SUM(CASE WHEN month = '#variables.MTD#' THEN count else 0 END)) AS DECIMAL(18, 2)) as 'c1'
, CAST((100.0 * SUM(CASE WHEN answer = 'yes' AND month = '#variables.Month2#' THEN count else NULL END)/SUM(CASE WHEN month = '#variables.Month2#' THEN count else 0 END)) AS DECIMAL(18, 2)) as 'c2'
, CAST((100.0 * SUM(CASE WHEN answer = 'yes' AND month = '#variables.Month3#' THEN count else NULL END)/SUM(CASE WHEN month = '#variables.Month3#' THEN count else 0 END)) AS DECIMAL(18, 2)) as 'c3'
, CAST((100.0 * SUM(CASE WHEN answer = 'yes' AND month = '#variables.Month4#' THEN count else NULL END)/SUM(CASE WHEN month = '#variables.Month4#' THEN count else 0 END)) AS DECIMAL(18, 2)) as 'c4'
from specialty_Call_Quality_Report_Questions
where week >= '#dateformat(DateAdd("m", -3, Now()), 'mm/dd/yyyy')#'
<cfif len(arguments.role) neq 0> AND role IN (<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.role#" list="true">)</cfif>
<cfif len(arguments.therapies) neq 0> AND therapy = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.therapies#"></cfif>
<cfif len(arguments.leaders) neq 0> AND leader = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.leaders#"></cfif>
<cfif len(arguments.sites) neq 0> AND site IN (<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.sites#" list="true">)</cfif>
<cfif len(arguments.supervisor) neq 0> AND supervisor = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.supervisor#"></cfif>
AND callQualityReportTypeID = <cfqueryparam cfsqltype="cf_sql_varchar"...
JavaScript
<cfquery name="LOCAL.qryResultsPACQualityQSOAllProcess" datasource="opscall">
SELECT *
FROM (
SELECT
site_cd,
CAST((100.0 * sum(qso_ct)/sum(eval_ct)) AS DECIMAL(18, 1)) as siteSum,
month as ed--,
--year
FROM specialty_Call_Quality_Report_PAC
where
callQualityReportTypeID = <cfqueryparam cfsqltype="cf_sql_interger" value="#arguments.reporttypeid#">
AND MTH >= '06/01/2016 00:00:00.000'
AND site_cd in (<cfqueryparam cfsqltype="cf_sql_varchar" value="#variables.pivotcolumns#" list="true">)
<cfif len(arguments.formd) gt 0>
AND form = <cfqueryparam cfsqltype="cf_sql_interger" value="#arguments.formd#">
</cfif>
group by year, month, site_cd
) as s
PIVOT
(
SUM(siteSum)
FOR [ed] IN (#local.list1#)
)AS pvt
</cfquery>
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.