sql日期查询有关问题,求大侠!

sql日期查询问题,求大侠!!!
id           date               value
20011 2013-6-24 18:00:00 43
20011 2013-6-24 19:00:00 40
20011 2013-6-24 20:00:00 29
20011 2013-6-24 21:00:00 22
20011 2013-6-24 22:00:00 17
20011 2013-6-24 23:00:00 14
20011 2013-6-25 0:00:00 6
20011 2013-6-25 1:00:00 4
20011 2013-6-25 2:00:00 5
20011 2013-6-25 3:00:00 4
20011 2013-6-25 4:00:00 3
20011 2013-6-25 5:00:00 4
20011 2013-6-25 6:00:00 8
20011 2013-6-25 7:00:00 396
20011 2013-6-25 8:00:00 701
类似上述数据,一年每天每个时刻都有,如何筛选出(例如:2013-06-25 3:00:00以前 对应每周这个点的数据如2013-06-18 3:00:00,2013-06-11 3:00:00,2013-06-14 3:00:00)同理还有月的!!!

------解决方案--------------------



if object_id('Tempdb..#a') is not null drop table #a
--建临时表
create table #a(
 ID int identity(1,1) not null,
 pdate  datetime null 
)
--建示例数据
declare @i int
declare @n int
declare @date datetime
declare @time nvarchar(9)
set @i=1
set @n=1000
set @date='2013-06-25 1:0:0'
set @time=' 03:00:00'
while @i<=@n
 begin
insert into #a select dateadd(hh,-1*@i,@date) 
 set @i=@i+1
 end
--查询
;with cte as(
select *,datediff(dd,pdate,@date) days,cast(left(pdate,10)+@time as datetime) theTime from #a
)
select * from cte  where days %7=0 and datediff(hh,pdate,theTime)=0

---------------------------
-----查询结果
ID          pdate                   days        theTime
----------- ----------------------- ----------- -----------------------
166         2013-06-18 03:00:00.000 7           2013-06-18 03:00:00.000