select id,sum(regcount) from mytest group by id having sum(regcount)>5;

解决方案 »

  1.   

    抱歉你没有看请我的问题:
    select id,sum(regcount) as totalcount from mytest group by id having totalcount>5这个是没有错的
      

  2.   

    不好意思,看错了,我用postgresql,你那个语句执行不了
    你那个mysql版本可能不支持嵌套查询
    select count(*) from (select id,sum(regcount) from mytest group by id having sum(regcount)>5) as a; 这个语句在postgresql里可以执行
      

  3.   

    是的,mysql4.0.18不支持嵌套查询,那还有什么方法可以间接实现吗?
      

  4.   

    我装了mysql 4.1.1 alpha版就可以了