我有一个基本的 group by/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 的任何结果。我该怎么做...?
只需添加一个having
clause:
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;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)