日期:2014-05-18  浏览次数:20659 次

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
Select
AVG(Isc) as Isc,  
AVG(Uoc) as Uoc
from a
having  AVG(Isc)>0 and AVG(Isc)<3 and AVG(Uoc)<8 and AVG(Uoc)>1

------解决方案--------------------
SQL code

Select
AVG(Isc) as Isc,  
AVG(Uoc) as Uoc
from a
[color=#FF0000]HAVING AVG(Isc) BETWEEN 0 AND 3 AND AVG(Uoc) BETWEEN 1 AND 8[/color]