表a,有字段email、num,现在要求:
查到供货量(num)超过5000的所有人(email)的供货总量?请问一下,能否用一条sql语句就返回结果??
不知道大家明白我的意思没有?

解决方案 »

  1.   

    select email,sum(num) from 表A group by email having sum(num)!<5000
      

  2.   

    select 供货总量=(select sum(num) from a where email=c.email) from a c where c.num >5000
      

  3.   

    select sum(num) rom a where email in(select email from a as bb where bb.num > 5000)
      

  4.   

    select email、sum(num) 供货总量 
    from 表a
    group by email
    having sum(num) > 5000
      

  5.   

    select emial,sum(num) from a group by email having num>5000
      

  6.   

    select emial,sum(num) from table1 group by email having sum(num)>5000
      

  7.   

    select sum(num) from a where email (select email from table1 group by email having sum(num)>5000)
      

  8.   

    select sum(num) from a where email= (select email from table1 group by email having sum(num)>5000)
    少了个=号
      

  9.   

    to no1francis() :
    得不出结果哦,sql错误
      

  10.   

    表a,有字段email、num,现在要求:
    查到供货量(num)超过5000的所有人(email)的供货总量?select sum(num) from a where num>5000
      

  11.   

    to cefriend(青草):
    是你想的太简单了,供货量大于5000是某个人的总供货量大于5000,不是单独的一个记录
    :)
      

  12.   

    select email, sum(num) from t group by email having sum(num)>5000
      

  13.   

    select email,count(1) from where num>5000 group by email
      

  14.   

    select email,sum(num) from where num>5000 group by email
    你那句话~~意思太多啦!
      

  15.   

    to cefriend(青草) :
    你写的语句上面不是早就有了吗?:(
      

  16.   

    select email, sum(num) num into #1 from t group by email having sum(num)>5000select sum(num) from #1