Last active
September 3, 2018 19:16
-
-
Save smaglio81/6773d94576cabf4156a3c15a76f5d090 to your computer and use it in GitHub Desktop.
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
create view vw_LCUComparison | |
with schemabinding | |
as | |
select s.[Date], s.[Time], s.[SiteName] | |
,e.WebAppCount | |
,e.lcus [rule-eval-lcus] | |
,n.lcus [new-conn-lcus] | |
,a.lcus [active-conn-lcus] | |
,b.lcus [bandwidth-lcus] | |
,(select max(v) from (values (n.lcus), (a.lcus), (b.lcus), (e.lcus)) as value(v)) as [max-lcus] | |
,case when (select max(v) from (values (n.lcus), (a.lcus), (b.lcus), (e.lcus)) as value(v)) = e.lcus then 1 else 0 end as [rule-eval-used] | |
,case when (select max(v) from (values (n.lcus), (a.lcus), (b.lcus), (e.lcus)) as value(v)) = n.lcus then 1 else 0 end as [new-conn-used] | |
,case when (select max(v) from (values (n.lcus), (a.lcus), (b.lcus), (e.lcus)) as value(v)) = a.lcus then 1 else 0 end as [active-conn-used] | |
,case when (select max(v) from (values (n.lcus), (a.lcus), (b.lcus), (e.lcus)) as value(v)) = b.lcus then 1 else 0 end as [bandwidth-used] | |
from dbo.ProxySiteRequestCounts s | |
inner join dbo.ProxySiteNewConnections n on s.[Date] = n.[Date] and s.[Time] = n.[Time] and s.[SiteName] = n.[SiteName] | |
inner join dbo.ProxySiteActiveConnections a on s.[Date] = a.[Date] and s.[Time] = a.[Time] and s.[SiteName] = a.[SiteName] | |
inner join dbo.ProxySiteBandwidth b on s.[Date] = b.[Date] and s.[Time] = b.[Time] and s.[SiteName] = b.[SiteName] | |
inner join dbo.ProxySiteRuleEvaluations e on s.[Date] = e.[Date] and s.[Time] = e.[Time] and s.[SiteName] = e.[SiteName] | |
go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment