我想在查询语句从数据库中查完所有数据后,直接返回一个所有数据的总和(当然,数据都是数字),不知道该用哪条SQL语句,哪位仁兄可以助小弟一把!不胜感激!*^O^*

解决方案 »

  1.   

    select sum(num) from table where 条件
      

  2.   

    select sum(num) from table where 条件
      

  3.   

    贴出你的代码,你在VB中怎样执行SQL的?
      

  4.   

    select sum(num) as numtatol from table where 条件dim i as double
    i=rs.fields("numtatol ").value
      

  5.   

    Set Rs = Conn.Execute(" select sum(费用合计) from 某用户的费用 where 收费年份= " & y & " and 收费月份= " & m & " and state='1' ")
      

  6.   

    Conn.Execute(" select sum(费用合计) from 某用户的费用 where 收费年份= " & y & " and 收费月份= " & m & " and state='1' ")
    是不是应该直接这样写呀。
      

  7.   

    if rs.state=adstateopen then rs.close
    rs.open " select sum(费用合计) from 某用户的费用 where 收费年份= " & y & " and 收费月份= " & m & " and state='1' ",conn,adopenkeyset,adlockreadonly