create table #temp20110610
(
     id int identity(1,1),
     date varchar(8),
     qty float
)

insert into #temp20110610
select '20110401',40 union all
select '20110402',64 union all
select '20110403',56 union all
select '20110404',346 union all
select '20110405',56 union all
select '20110406',678 union all
select '20110407',1234 union all
select '20110408',560 union all
select '20110409',460 union all
select '20110410',566 union all
select '20110411',344 union all
select '20110412',77 union all
select '20110413',90

declare @SDate varchar(8),@EDate varchar(8),@conditionQty float
set @SDate='20110405'
set @EDate='20110411'
set @conditionQty=3000
--得到指定日期范围类,Qty列的累积数量大于3000
select id,date,qty,
(select SUM(qty) from #temp20110610 where date<=A.date and date between @SDate and @EDate) Qty累计量
from #temp20110610 A
where (select SUM(qty) from #temp20110610 where date<=A.date and date between @SDate and @EDate)<=@conditionQty
and date between @SDate and @EDate
order by A.date

最新文章

  1. 用php实现一个简单的链式操作
  2. Python学习笔记(四)字符串型
  3. 回忆读windows 核心编程
  4. [PHP100] PHP如何防止注入及开发安全
  5. SAP传输系统TMS、开发类、传输请求
  6. 【C++基础】关键字static 局部变量
  7. Android studio中找不到so文件的问题:java.lang.UnsatisfiedLinkError
  8. JavaScript系列----事件机制
  9. salesforce零基础学习(八十二)审批邮件获取最终审批人和审批意见
  10. Kudu存储实战笔记
  11. 以太坊ERC20代币开发
  12. C# ADO.NET的SqlDataReader对象,判断是否包含指定字段
  13. day5 笔记
  14. centos U盘挂载问题
  15. static之静态初始化块
  16. FF笔试题整理
  17. Linux 压缩解压缩命令详解
  18. 20145330 《网络攻防》 MSF基础应用
  19. RepositionBars的用法和参数的意义(引用别人的)
  20. Citrix服务器虚拟化之二十九 XenApp 6.5发布服务器上的应用程序

热门文章

  1. btrfs基础
  2. asp网站中使用百度ueditor教程.txt
  3. webpack打包出错,通过babel将es6转es5的出错。
  4. BZOJ 1631 Usaco 2007 Feb. Cow Party
  5. 公钥基本结构(PKI)的概念
  6. ActiveMQ学习总结(10)——ActiveMQ采用Spring注解方式发送和监听
  7. hdu6096 String
  8. Master Nginx(8) - Troubleshooting Techniques
  9. [bzoj4385][POI2015]Wilcze doły_单调队列
  10. HDU 4542