我表中有一个字段A,就像下面的样子  
A  
4  
2  
3  
4  
.....  
现在我要建一个视图,增加B字段B的记录为  
B  
4  

9  
13  
.......即B中的每条记录为A中记录一个累加的过程  
请问这样的功能怎么写???谢谢啦~!!! 
请给出; 相应代码,谢谢了

解决方案 »

  1.   

    select a,count(a) from mytable group by a order by a
      

  2.   

    select b=(select sum(a) from (select a,id=(select count(*) from yourtable where a<=t.a) from yourtable t) t where t.id<=t2.id) from (select a,id=(select count(*) from yourtable where id<=t.a) from yourtable t) t2
      

  3.   

    楼上的根本就语法错误~faint
      

  4.   

    我自己解决了,直接在程序中用datatable实现。现在要强制结贴拉,~~随便给了
      

  5.   

    我自己解决了,直接在程序中用datatable实现。现在要强制结贴拉,~~随便给了