本帖最后由 jainkai 于 2012-03-17 12:52:37 编辑

解决方案 »

  1.   

    select sum(产品1),sum(产品2),sum(产品3) from table
      

  2.   


    select product as 产品, sum(quantity) as 数量 from (
    select '产品1' as product, 2 as quantity from dual
    union all
    select '产品2', 3 
    union all
    select '产品3', 4 
    union all
    select '产品2', 2 
    union all
    select '产品1', 6 
    union all
    select '产品4', 7 
    )
    group by product--结果
    产品    数量                     
    ----- ---------------------- 
    产品3 4                      
    产品1 8                      
    产品2 5                      
    产品4 7 打开数据源,ADODC
    绑定DATAGRID
    请楼主自己写吧,我快三年没写过VB代码了。
      

  3.   

    SQL SERVER语法还有一种写法COMPUTE BYSELECT 产品,数量 from tableName 
    order by 产品
    compute SUM(数量) by 产品