string sql="select sum(num)as test,test2,test3 from table where time >'2012-03-02' and time <2012-04-01";怎么把这个时间段内的每一天的数据都查询出来(从三月2号开始 到四月一号的这中间的每一天)?? 而且这里有个求和,请问这个该怎么写?请教各位了  
想得到的结果是 
 03-02 这天  num总和数,test2,test3
  03-03 这天 。。
  依次下去 直到04-01这天 
 然后显示绑定到girdview里面 
   

解决方案 »

  1.   

    time是字符型还是日期型?用的什么数据库?test2和test3是什么?可以考虑用group by
      

  2.   

    给你个实例:select sum(num)as test,test2,test3 from table where time >to_date('2012-03-02','yyyy-mm-dd') and time <to_date('012-04-01','yyyy-mm-dd') group by time order by time
      

  3.   

    select sum(consume),day([date]) from consume_record where [date] between to_date('2012-03-02','yyyy-mm-dd') and to_date('012-04-01','yyyy-mm-dd')  group by day([date]) 按天分组
      

  4.   

    大哥 to_date函数怎么不能识别啊 ??我表里面的字段是日期类型的了