获得指定时间段内原始数据表 #tbl0select *,DATEDIFF ( hh, '2010-11-1' , TimeC) as beginhour,DATEDIFF ( hh,TimeC,'2010-11-30' ) as endhour From [vp_product] where TimeC between '2010-11-1' and '2010-11-30'全部产品编码#tbidselect distinct ProID from#tbl0 期初数#begin:select * from #tbl0(select ProID,min(beginhour) From #tbl0 gro |