select a form taba
1990/1/7 上午 08:00:00
1990/1/1 上午 08:00:00
1990/1/1 上午 08:00:00
1990/1/2 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00
1990/1/3 上午 08:00:00
1990/1/4 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/6 上午 08:00:00
1990/1/7 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00
1990/1/3 上午 08:22:00
1990/1/4 上午 08:33:00
1990/1/5 上午 08:44:00
1990/1/6 上午 08:56:00
1990/1/7 上午 08:10:00
1990/1/8 上午 08:10:00
1990/1/9 上午 08:21:00
查询的条件是 显示出连续7天并且时间相同的数据 得到的结果是
1990/1/3 上午 08:00:00
1990/1/4 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/6 上午 08:00:00
1990/1/7 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00希望大家帮帮忙 这个需要写循环~~~
1990/1/7 上午 08:00:00
1990/1/1 上午 08:00:00
1990/1/1 上午 08:00:00
1990/1/2 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00
1990/1/3 上午 08:00:00
1990/1/4 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/6 上午 08:00:00
1990/1/7 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00
1990/1/3 上午 08:22:00
1990/1/4 上午 08:33:00
1990/1/5 上午 08:44:00
1990/1/6 上午 08:56:00
1990/1/7 上午 08:10:00
1990/1/8 上午 08:10:00
1990/1/9 上午 08:21:00
查询的条件是 显示出连续7天并且时间相同的数据 得到的结果是
1990/1/3 上午 08:00:00
1990/1/4 上午 08:00:00
1990/1/5 上午 08:00:00
1990/1/6 上午 08:00:00
1990/1/7 上午 08:00:00
1990/1/8 上午 08:00:00
1990/1/9 上午 08:00:00希望大家帮帮忙 这个需要写循环~~~
解决方案 »
- 简单Select的小问题,大家请进来帮忙看看
- 急、高手进来看!
- 查看sqlserver数据库的编码
- SQL Server有时间触发器吗
- 加上n个工作日后的日期
- 怎样检查字段中是否包括中文字符(简体繁体)?
- 在线等待一个存储过程和一个触发器的问题
- 在同一台机器上将英文Windows NT+SQL Server 6.5升级到中文Windows NT+SQL Server 7.0应注意什么?数据如何转?
- ***要实现这个功能,能否写个存储过程??60分
- 在vb程序中(sqlserver)我已得到一ado记录集rstproduct,我需要将它放入一临时表再作进一步处理,请教如何将其放入一临时表?哪有相关资料?
- 1,2,3,4的查询方法
- SQL SERVER 2005表分区,关于分区方案的划分的问题
if object_id('tempdb.dbo.#T') is not null drop table #T
create table #T (a datetime)
insert into #T
select '1990/1/7 08:00:00' union all
select '1990/1/1 08:00:00' union all
select '1990/1/1 08:00:00' union all
select '1990/1/2 08:00:00' union all
select '1990/1/5 08:00:00' union all
select '1990/1/8 08:00:00' union all
select '1990/1/9 08:00:00' union all
select '1990/1/3 08:00:00' union all
select '1990/1/4 08:00:00' union all
select '1990/1/5 08:00:00' union all
select '1990/1/6 08:00:00' union all
select '1990/1/7 08:00:00' union all
select '1990/1/8 08:00:00' union all
select '1990/1/9 08:00:00' union all
select '1990/1/3 08:22:00' union all
select '1990/1/4 08:33:00' union all
select '1990/1/5 08:44:00' union all
select '1990/1/6 08:56:00' union all
select '1990/1/7 08:10:00' union all
select '1990/1/8 08:10:00' union all
select '1990/1/9 08:21:00';if object_id('tempdb.dbo.#') is not null drop table #
select id=cast(null as int),* into # from #T;declare @a datetime,@id int
set @id=0
update # set id=@id,@id=case when dateadd(day,1,@a)=a then @id else @id+1 end, @a=aselect a from # as t where (select count(1) from # where id=t.id)=7/*
a
-----------------------
1990-01-03 08:00:00.000
1990-01-04 08:00:00.000
1990-01-05 08:00:00.000
1990-01-06 08:00:00.000
1990-01-07 08:00:00.000
1990-01-08 08:00:00.000
1990-01-09 08:00:00.000
*/