select 产品,sum(数量) from table
where 日期>=beginday and  日期 <=endday
group by 产品

解决方案 »

  1.   

    select 产品,sum(数量) from table
    where 日期>=beginday and  日期 <=endday
    group by 产品
      

  2.   

    select 产品,sum(数量) from table
    where 日期 between beginday and  endday
    group by 产品
      

  3.   

    "select 产品列,sum(数量) 数量 from 表1 where日期>='" & timeF & "' and 日期<='" & timeT& "' group by 产品列"
      

  4.   

    :) SQL 语句我知道啊 怎么传如SQL SERVER 呢?SQL SERVER  里又不认识vb中的变量的啊
      

  5.   

    你发贴子的地方不对,去.net中发
    要传递参数用parameter对象,然后调用存储过程
      

  6.   

    下面的可以吧?
                DataSet1.Clear()
                SqlDataAdapter2.SelectCommand.CommandText = "select 产品,sum(数量) 数量 from 表1 where 日期>='" & timeF & "' and 日期<='" & timeT & "' group by 产品"
                SqlDataAdapter1.Fill(DataSet1, "表1")