这是我的查询
SELECT
client_id,
TimesTested,
CAST(COUNT(*) AS varchar(30)) AS count,
CAST(AVG(testfreq) as varchar(30)) as TestFreq,
CAST(STDEV(TestFreq) as varchar(30)) Stdv
FROM counted
GROUP BY
client_id,
TimesTested
有用; 但是,我需要过滤 testfreq>0 的 AVG 和 STDEV,但我需要不过滤 count(*)。
最接近的是:
SELECT
client_id,
TimesTested,
CAST(COUNT(*) AS varchar(30)) AS count,
CAST(AVG(testfreq) as varchar(30)) as TestFreq,
CAST(STDEV(TestFreq) as varchar(30)) Stdv
FROM counted
where testfreq>0 --however I don't want this filtered applied to count(*)
GROUP BY
client_id,
TimesTested
非常感谢您的指导!