declare @sum money
select @sum = sum(tot) from yourtable where edate >= '2003-01-01'

解决方案 »

  1.   

    Select Sum(Field1) as Field from table1 where 条件
      

  2.   

    Select a,b,c,Sum(d) as d from tablename where 条件 group by a,b,c
      

  3.   

    select sum(isnull(字段,0)) as total from table where [date] between
    begindate and enddate order by [date]
      

  4.   

    Select Sum(Field1) as Field123 from 表 where 条件
      

  5.   

    select sum(字段) as kk from 表 where 条件
      

  6.   

    table hao     money
    101     20
    101     10
    101     10
    102     10
    102     5
    103     8
    103     16
    这样的查询结果
    hao   total_money
    101     40
    102     15
    103     24
    select hao,sum(money) as total_money from yourtable group by hao
      

  7.   

    select sum(field1) from table1 group by field2