计算问题
Sid                  Money                  Kid 
 1                           100                        1 
 1                           100                        2 
 1                           100                        3 
 2                           200                        1 
 2                           200                        2 
 3                           400                        5 
 没有主键,要求得到MONEY的和,但相同的Sid只计算一次MOney,即变量@a   =   100+200+400   =   700,如何过滤条件?
------解决方案--------------------select sum(money) from(select max( money)[money] from tab group by Sid)a
------解决方案--------------------select sum(Money) from (select Min(Money) as Money from 表 group by Sid)t
------解决方案--------------------select sum(hj) as 总合计 
 from (select min([Money]) as hj from 表名 group by Sid) t 
------解决方案--------------------  declare @t table(sid int,[money] int,kid int)   
 insert into @t select 1,         100,        1 
 insert into @t select 1,         100,        2 
 insert into @t select 1,         100,        3 
 insert into @t select 2,         200,        1 
 insert into @t select 2,         200,        2 
 insert into @t select 3,         400,        5   
 select sum([money]) from ( select sid,[money] from @t 
 group by sid,[money]) a   
 -- 
 700