select 字符字段,sum(数字字段) from tableA
group by 字符字段
having sum(数字字段)>100

解决方案 »

  1.   

    select * from (select col2,sum(col3) as col4 from a group by col2) x where col4>100
      

  2.   

    select col1, sum(col2) from table1 
    group by col1
    having sum(col2)>100
      

  3.   

    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]列 'client.namet' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。 怎么提示这样的错误啊!!!!
      

  4.   

    太简单了,最基本的SQL语句用法
      

  5.   

    select 字符字段,sum(数字字段) 
    from tableA
    group by 字符字段
    having sum(数字字段)>100完全正确啊
      

  6.   

    我想多显示一些其他字段呢,就会抱错误
    select * from (select idnot,namet,professiont,mobilet,phonet,addr,insur_code,sum(money)as col4 from client group by idnot) x where col4>"+baoe+"
    这样改写可以吗?????
      

  7.   

    在group by 分组统计语句中,select 后面的非合计字段必须包含在group by 类表中,如
    select idnot,namet,professiont,mobilet,phonet,addr,insur_code,sum(money)as col4 from client 
    group by idnot,namet,professiont,mobilet,phonet,addr,insur_code