sql Report-Adhoc Requests.sql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Report-Adhoc Requests.sql相关的知识,希望对你有一定的参考价值。

-------------------------------Secondary Role[AssessmentTime] Vs Engineer Count Vs Assessment Count-------------------------------
SELECT u.SecondaryRole
	,cxr.Id AS CenterSecondaryRoleId
	,count(u.UserId) AS [EngineerCountRmr]
	,(
		SELECT count(a.AssessmentId)
		FROM dbo.Assessment a
		WHERE a.IsActive = 1
			AND a.CenterSecondaryRoleId = cxr.Id
		) AssessmentCount
FROM dbo.[User] u
INNER JOIN dbo.SecondaryRoleMaster srm ON ltrim(rtrim(upper(u.SecondaryRole))) = ltrim(rtrim(upper(srm.NAME)))
INNER JOIN dbo.CenterXSecondaryRole cxr ON srm.Id = cxr.SecondaryRoleId
GROUP BY u.SecondaryRole
	,cxr.Id
ORDER BY u.SecondaryRole

-------------------------------Secondary Role[Current] ,Participated Engineer Count-------------------------------
SELECT u.SecondaryRole
	,Count(DISTINCT u.UserId) AS UniqueEngineersCount
FROM dbo.Assessment a
INNER JOIN dbo.UserCenterXCenterPguSkill ucxps ON a.UserCenterXCenterPguSkillId = ucxps.Id
INNER JOIN dbo.UserXCenter ux ON ucxps.UserXCenterId = ux.UserXCenterId
INNER JOIN dbo.[User] u ON ux.UserId = u.UserId
	AND u.IsActive = 1
WHERE a.IsActive = 1
GROUP BY u.SecondaryRole
ORDER BY 1

------------------------Head Count Wave Region Country Facility Pgu Skill----------------------------------
SELECT t1.Wave
	,t1.Region
	,t1.Country
	,t1.FacilityDesc
	,t1.Pgu
	,t1.SkillName
	,count(DISTINCT t1.EngUserId) UniqueEngineersCount
FROM [dbo].[Generic$] t1
GROUP BY t1.Wave
	,t1.Region
	,t1.Country
	,t1.FacilityDesc
	,t1.Pgu
	,t1.SkillName
ORDER BY t1.Wave
	,t1.Region
	,t1.Country
	,t1.FacilityDesc
	,t1.Pgu
	,t1.SkillName




以上是关于sql Report-Adhoc Requests.sql的主要内容,如果未能解决你的问题,请参考以下文章

SQL 合并计数结果

更新 SQL Server 2005 中的表列

如何创建 python+requests接口自动化测试框架

SQL Server通过动态视图里查找阻塞超过30秒的会话

python+requests+unittest API接口测试

EXP-sql布偶型盲注 保姆级教程新手向(Metinfo5)