我有/ avg声明的基本组:
select url, avg(contentping+tcpping), count(*) from websites ws, ping pi
where ws.idwebsite = pi.idwebsite and errortype is null
group by url order by avg(contentping+tcpping) asc;
我现在要做的是删除任何高于平均ping 500的结果。我该怎么做...?
答案 0 :(得分:13)
只需添加having
子句:
select url, avg(contentping+tcpping), count(*) from websites ws, ping pi
where ws.idwebsite = pi.idwebsite and errortype is null
group by url
having avg(contenetping+tcpping) < 500
order by avg(contentping+tcpping) asc;