我正在撰写此查询:
with CTE as
(
SELECT testCategory, testType, compareTestCategory,A.MEDIAN, A.average from
tInputValue_SamplesRequired
)
Select testCategory,testType,C.Median,C.Average,C.Median + D.Median as change,C.Average + D.average as [%change],C.compareTestCat from CTE C
left outer CTE D
on C.testCategory = D.compareTestCategory
and C.testType = D.testType
右边,如果比较测试类别等于测试类别,我想用中位数和平均值来计算。