提问一个sql语句,帮我看看!
select uid,sum(shu1) as shu1he,sum(shu2) as shu2he,shu1+shu2 as zonghe
from shuzi
group by uid
中,如果要将zonghe小于1000的不显示出来,应该怎么加呢?
------解决方案--------------------select uid,sum(shu1) as shu1he,sum(shu2) as shu2he,sum(shu1+shu2) as zonghe
from shuzi
group by uid
group by uid having sum(shu1+shu2)> =1000
------解决方案--------------------select uid,
sum(shu1) as shu1he,
sum(shu2) as shu2he,
sum(shu1+shu2) as zonghe
from shuzi
group by uid
having sum(shu1+shu2)> =1000
------解决方案--------------------select * from (select uid,sum(shu1) as shu1he,sum(shu2) as shu2he,shu1+shu2 as zonghe
from shuzi
group by uid) as a where a.zonghe> =1000