如下图:将订单表dd中,dd_date时间 在统计表start_date,end_date区间内1cusT_id的不重复个数,更新到 统计表的tj_dec01字段,如下图需要回填的个数是:3
统计表TJ:id,tj_dec01,start_date,end_date
1 3 2010-06-12 2010-06-25 订单表dd:id,cust_id,dd_date
1 12 2010-06-12
2 22 2010-06-18
3 15 2010-06-20
4 12 2010-06-22
5 12 2010-06-24
统计表TJ:id,tj_dec01,start_date,end_date
1 3 2010-06-12 2010-06-25 订单表dd:id,cust_id,dd_date
1 12 2010-06-12
2 22 2010-06-18
3 15 2010-06-20
4 12 2010-06-22
5 12 2010-06-24
解决方案 »
- SQL语句效率很慢,请朋友们帮忙下
- 如果不用游标 如何循环我要的数据
- 使用sp_executesql
- 我要执行一存储过程,在我设定的时间范围内间隔3分钟执行一次
- sqlservr.exe 进程占用cpu100%,只要上网,一会就会变100%,查了没病毒,如何解决?
- 请邹老大过来看看,难啊
- 怎么样在SQL查询分析器中把unicode字符显示出来
- 在线等待 安装问题 我用的是WINXP 在安装SQL SEVER2000时只能安装 仅客户端工具 和 连接工具
- 关于ACCESS的疑问
- 请问 一句改序号的 SQL 谢谢!
- 在线~~~各位帮忙。给我说一下关于sql的事务处理。感激。。。!!!!
- 存储过程调用问题
(select count(distinct cust_id)
from 订单表dd
where dd_date between start_date and end_date)