当前位置: 代码迷 >> Sql Server >> sql语句的有关问题,小弟我又来了!
  详细解决方案

sql语句的有关问题,小弟我又来了!

热度:100   发布时间:2016-04-27 12:10:11.0
sql语句的问题,我又来了!!!
Select
AVG(Isc) as Isc, 
AVG(Uoc) as Uoc
from a
如:  
Isc Uoc
1 2
5 4
现在求的是Isc和Uoc的平均数,
然后我想在这个基础上再求,平均的Isc小于3大于0 并且 Uoc小于8 大于1的

结果:
Isc Uoc
1 2

问,怎么写?

------解决方案--------------------
SQL code
SelectAVG(Isc) as Isc,  AVG(Uoc) as Uocfrom ahaving  AVG(Isc)>0 and AVG(Isc)<3 and AVG(Uoc)<8 and AVG(Uoc)>1
------解决方案--------------------
SQL code
SelectAVG(Isc) as Isc,  AVG(Uoc) as Uocfrom a[color=#FF0000]HAVING AVG(Isc) BETWEEN 0 AND 3 AND AVG(Uoc) BETWEEN 1 AND 8[/color]
  相关解决方案